Mixed Rules

    1. - !SHARDING
    2. tables:
    3. t_order:
    4. actualDataNodes: replica_ds_${0..1}.t_order_${0..1}
    5. tableStrategy:
    6. standard:
    7. shardingColumn: order_id
    8. shardingAlgorithmName: t_order_inline
    9. keyGenerateStrategy:
    10. column: order_id
    11. keyGeneratorName: snowflake
    12. defaultDatabaseStrategy:
    13. standard:
    14. shardingColumn: user_id
    15. shardingAlgorithmName: database_inline
    16. shardingAlgorithms:
    17. database_inline:
    18. type: INLINE
    19. props:
    20. algorithm-expression: replica_ds_${user_id % 2}
    21. t_order_inline:
    22. type: INLINE
    23. props:
    24. algorithm-expression: t_order_${order_id % 2}
    25. type: INLINE
    26. algorithm-expression: t_order_item_${order_id % 2}
    27. keyGenerators:
    28. snowflake:
    29. type: SNOWFLAKE
    30. - !READWRITE_SPLITTING
    31. dataSources:
    32. replica_ds_0:
    33. dynamicStrategy:
    34. autoAwareDataSourceName: readwrite_ds_0
    35. replica_ds_1:
    36. dynamicStrategy:
    37. autoAwareDataSourceName: readwrite_ds_1
    38. - !DB_DISCOVERY
    39. dataSources:
    40. readwrite_ds_0:
    41. dataSourceNames:
    42. - ds_0
    43. - ds_1
    44. - ds_2
    45. discoveryHeartbeatName: mgr-heartbeat
    46. discoveryTypeName: mgr
    47. readwrite_ds_1:
    48. dataSourceNames:
    49. - ds_3
    50. - ds_4
    51. - ds_5
    52. discoveryTypeName: mgr
    53. discoveryHeartbeats:
    54. mgr-heartbeat:
    55. props:
    56. keep-alive-cron: '0/5 * * * * ?'
    57. discoveryTypes:
    58. mgr:
    59. type: MySQL.MGR
    60. props:
    61. group-name: 558edd3c-02ec-11ea-9bb3-080027e39bd2
    62. - !ENCRYPT
    63. encryptors:
    64. aes_encryptor:
    65. type: AES
    66. props:
    67. aes-key-value: 123456abc
    68. md5_encryptor:
    69. type: MD5
    70. tables:
    71. t_encrypt:
    72. columns:
    73. user_id:
    74. plainColumn: user_plain
    75. cipherColumn: user_cipher
    76. encryptorName: aes_encryptor
    77. order_id:
    78. encryptorName: md5_encryptor