1.4.0.0-RC1 升级到4.1.1 分表加主从配置
shardingsphere.datasource.master0.driver-class-name=com.mysql.cj.jdbc.Driver
shardingsphere.datasource.master0.jdbc-url=
shardingsphere.datasource.master0.username=
shardingsphere.datasource.master0.password=
shardingsphere.datasource.master0.minimum-idle=5
shardingsphere.datasource.master0.maximum-pool-size=50
shardingsphere.datasource.master0.auto-commit=true
shardingsphere.datasource.master0.idle-timeout=30000
shardingsphere.datasource.master0.pool-name=DatebookHikariCP
shardingsphere.datasource.master0.max-lifetime=1800000
shardingsphere.datasource.master0.connection-timeout=30000
shardingsphere.datasource.master0.connection-test-query=SELECT 1
shardingsphere.datasource.slave0.type=com.zaxxer.hikari.HikariDataSource
shardingsphere.datasource.slave0.driver-class-name=com.mysql.cj.jdbc.Driver
shardingsphere.datasource.slave0.jdbc-url=
shardingsphere.datasource.slave0.username=
shardingsphere.datasource.slave0.password=
shardingsphere.datasource.slave0.minimum-idle=5
shardingsphere.datasource.slave0.maximum-pool-size=50
shardingsphere.datasource.slave0.auto-commit=true
shardingsphere.datasource.slave0.idle-timeout=30000
shardingsphere.datasource.slave0.pool-name=DatebookHikariCP
shardingsphere.datasource.slave0.max-lifetime=1800000
shardingsphere.datasource.slave0.connection-timeout=30000
shardingsphere.datasource.slave0.connection-test-query=SELECT 1
shardingsphere.datasource.masterslave.load-balance-algorithm-type=round_robin
shardingsphere.datasource.masterslave.name=ms
shardingsphere.props.sql.show=true
shardingsphere.sharding.master-slave-rules.master0.master-data-source-name=master0
shardingsphere.sharding.master-slave-rules.master0.slave-data-source-names=slave0
shardingsphere.sharding.tables.sy_user_commission_log.actual-data-nodes=master0.sy_user_commission_log$->{0..3}
shardingsphere.sharding.tables.sy_user_commission_log.table-strategy.standard.sharding-column=user_id
shardingsphere.sharding.tables.sy_user_commission_log.table-strategy.standard.precise-algorithm-class-name=com.pluss.platform.app.configuration.UserIdPreciseShardingAlgorithm
shardingsphere.sharding.tables.sy_user_account_log.actual-data-nodes=master0.sy_user_account_log$->{0..3}
区别点:配置错了从节点不走分表
4.1.1如下
shardingsphere.datasource.masterslave.load-balance-algorithm-type=round_robin
shardingsphere.datasource.masterslave.name=ms
4.0.0
spring.shardingsphere.masterslave.load-balance-algorithm-type=round_robin spring.shardingsphere.masterslave.name=ms