Mixed Rules

    Below, you will find the parameters’ explanation and configuration samples based on SpringBoot Starter.

    1. spring.shardingsphere.rules.sharding.tables.t_order.actual-data-nodes=replica-ds-$->{0..1}.t_order_$->{0..1}
    2. spring.shardingsphere.rules.sharding.tables.t_order.table-strategy.standard.sharding-column=order_id
    3. spring.shardingsphere.rules.sharding.tables.t_order.table-strategy.standard.sharding-algorithm-name=t-order-inline
    4. spring.shardingsphere.rules.sharding.tables.t_order.key-generate-strategy.column=order_id
    5. spring.shardingsphere.rules.sharding.tables.t_order.key-generate-strategy.key-generator-name=snowflake
    6. spring.shardingsphere.rules.sharding.tables.t_order_item.actual-data-nodes=replica-ds-$->{0..1}.t_order_item_$->{0..1}
    7. spring.shardingsphere.rules.sharding.tables.t_order_item.table-strategy.standard.sharding-column=order_id
    8. spring.shardingsphere.rules.sharding.sharding-algorithms.database-inline.type=INLINE
    9. spring.shardingsphere.rules.sharding.sharding-algorithms.t-order-inline.type=INLINE
    10. spring.shardingsphere.rules.sharding.sharding-algorithms.t-order-inline.props.algorithm-expression=t_order_$->{order_id % 2}
    11. # Dynamic read/write splitting configuration
    12. spring.shardingsphere.rules.readwrite-splitting.data-sources.replica-ds-0.dynamic-strategy.auto-aware-data-source-name=readwrite-ds-0
    13. spring.shardingsphere.rules.readwrite-splitting.data-sources.replica-ds-1.dynamic-strategy.auto-aware-data-source-name=readwrite-ds-1
    14. # Database discovery configuration
    15. spring.shardingsphere.rules.database-discovery.data-sources.readwrite-ds-0.data-source-names=ds-0, ds-1, ds-2
    16. spring.shardingsphere.rules.database-discovery.data-sources.readwrite-ds-0.discovery-heartbeat-name=mgr-heartbeat
    17. spring.shardingsphere.rules.database-discovery.data-sources.readwrite-ds-0.discovery-type-name=mgr
    18. spring.shardingsphere.rules.database-discovery.data-sources.readwrite-ds-1.data-source-names=ds-3, ds-4, ds-5
    19. spring.shardingsphere.rules.database-discovery.data-sources.readwrite-ds-1.discovery-heartbeat-name=mgr-heartbeat
    20. spring.shardingsphere.rules.database-discovery.discovery-heartbeats.mgr-heartbeat.props.keep-alive-cron=0/5 * * * * ?
    21. spring.shardingsphere.rules.database-discovery.discovery-types.mgr.props.groupName=b13df29e-90b6-11e8-8d1b-525400fc3996
    22. # Data decryption
    23. spring.shardingsphere.rules.encrypt.encryptors.name-encryptor.type=AES
    24. spring.shardingsphere.rules.encrypt.encryptors.name-encryptor.props.aes-key-value=123456abc
    25. spring.shardingsphere.rules.encrypt.encryptors.pwd-encryptor.type=AES
    26. spring.shardingsphere.rules.encrypt.encryptors.pwd-encryptor.props.aes-key-value=123456abc
    27. spring.shardingsphere.rules.encrypt.tables.t_user.columns.username.cipher-column=username
    28. spring.shardingsphere.rules.encrypt.tables.t_user.columns.username.encryptor-name=name-encryptor
    29. spring.shardingsphere.rules.encrypt.tables.t_user.columns.pwd.cipher-column=pwd
    30. spring.shardingsphere.rules.encrypt.tables.t_user.columns.pwd.encryptor-name=pwd-encryptor