时间:2021-07-01 10:21:17 帮助过:70人阅读
2.分库规则
spring.shardingsphere.rules.sharding.tables.t_order.actual-data-nodes=ds$->{0..1}.t_order
3.声明分片键和分片算法
spring.shardingsphere.rules.sharding.tables.t_order.database-strategy.standard.sharding-column=order_id spring.shardingsphere.rules.sharding.tables.t_order.database-strategy.standard.sharding-algorithm-name=database-inline spring.shardingsphere.rules.sharding.sharding-algorithms.database-inline.type=INLINE spring.shardingsphere.rules.sharding.sharding-algorithms.database-inline.props.algorithm-expression=ds$->{order_id % 2}
4.配置snowflake作为主键生成算法
spring.shardingsphere.rules.sharding.tables.t_order.key-generate-strategy.column=order_id spring.shardingsphere.rules.sharding.tables.t_order.key-generate-strategy.key-generator-name=snowflake spring.shardingsphere.rules.sharding.key-generators.snowflake.type=SNOWFLAKE spring.shardingsphere.rules.sharding.key-generators.snowflake.props.worker-id=1 spring.shardingsphere.rules.sharding.key-generators.snowflake.props.max-vibration-offset=1 spring.shardingsphere.rules.sharding.key-generators.snowflake.props.max-tolerate-time-difference-milliseconds=10
ShardingSphere系列(一)——ShardingSphere-JDBC初体验
标签:-o 轻量 lin sql orm sid 版本 介绍 prope