Mixed Rules
- !SHARDING
tables:
t_order:
actualDataNodes: replica_ds_${0..1}.t_order_${0..1}
tableStrategy:
standard:
shardingColumn: order_id
shardingAlgorithmName: t_order_inline
keyGenerateStrategy:
column: order_id
keyGeneratorName: snowflake
defaultDatabaseStrategy:
standard:
shardingColumn: user_id
shardingAlgorithmName: database_inline
shardingAlgorithms:
database_inline:
type: INLINE
props:
algorithm-expression: replica_ds_${user_id % 2}
t_order_inline:
type: INLINE
props:
algorithm-expression: t_order_${order_id % 2}
t_order_item_inline:
type: INLINE
algorithm-expression: t_order_item_${order_id % 2}
keyGenerators:
type: SNOWFLAKE
- !READWRITE_SPLITTING
dataSources:
replica_ds_0:
dynamicStrategy:
autoAwareDataSourceName: readwrite_ds_0
replica_ds_1:
dynamicStrategy:
autoAwareDataSourceName: readwrite_ds_1
- !DB_DISCOVERY
dataSources:
readwrite_ds_0:
dataSourceNames:
- ds_0
- ds_1
- ds_2
discoveryHeartbeatName: mgr_heartbeat
discoveryTypeName: mgr
readwrite_ds_1:
dataSourceNames:
- ds_3
- ds_4
- ds_5
discoveryHeartbeatName: mgr_heartbeat
discoveryTypeName: mgr
discoveryHeartbeats:
mgr_heartbeat:
keep-alive-cron: '0/5 * * * * ?'
mgr:
type: MySQL.MGR
props:
group-name: 558edd3c-02ec-11ea-9bb3-080027e39bd2
- !ENCRYPT
encryptors:
aes_encryptor:
type: AES
props:
aes-key-value: 123456abc
md5_encryptor:
type: MD5
like_encryptor:
type: CHAR_DIGEST_LIKE
tables:
t_encrypt:
columns:
user_id:
plainColumn: user_plain
cipherColumn: user_cipher
encryptorName: aes_encryptor
assistedQueryColumn: assisted_query_user
assistedQueryEncryptorName: aes_encryptor
likeQueryColumn: like_query_user
likeQueryEncryptorName: like_encryptor
order_id:
cipherColumn: order_cipher
encryptorName: md5_encryptor