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. t_order_item_inline:
    26. type: INLINE
    27. algorithm-expression: t_order_item_${order_id % 2}
    28. keyGenerators:
    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. discoveryHeartbeatName: mgr_heartbeat
    53. discoveryTypeName: mgr
    54. discoveryHeartbeats:
    55. mgr_heartbeat:
    56. keep-alive-cron: '0/5 * * * * ?'
    57. mgr:
    58. type: MySQL.MGR
    59. props:
    60. group-name: 558edd3c-02ec-11ea-9bb3-080027e39bd2
    61. - !ENCRYPT
    62. encryptors:
    63. aes_encryptor:
    64. type: AES
    65. props:
    66. aes-key-value: 123456abc
    67. md5_encryptor:
    68. type: MD5
    69. like_encryptor:
    70. type: CHAR_DIGEST_LIKE
    71. tables:
    72. t_encrypt:
    73. columns:
    74. user_id:
    75. plainColumn: user_plain
    76. cipherColumn: user_cipher
    77. encryptorName: aes_encryptor
    78. assistedQueryColumn: assisted_query_user
    79. assistedQueryEncryptorName: aes_encryptor
    80. likeQueryColumn: like_query_user
    81. likeQueryEncryptorName: like_encryptor
    82. order_id:
    83. cipherColumn: order_cipher
    84. encryptorName: md5_encryptor