spring: shardingsphere: datasource: # names: ds_master_0,ds_master_1,ds_master_0_slave_0,ds_master_0_slave_1,ds_master_1_slave_0,ds_master_1_slave_1 names: ds_master_0,ds_master_1 # ds_master_0_slave_0: # jdbc-url: jdbc:mysql://localhost:3306/demo_ds_master_0_slave_0?serverTimezone=UTC&useSSL=false&useUnicode=true&characterEncoding=UTF-8 # password: # type: com.zaxxer.hikari.HikariDataSource # driver-class-name: com.mysql.jdbc.Driver # username: root ds_master_0: driver-class-name: com.mysql.jdbc.Driver type: com.alibaba.druid.pool.DruidDataSource jdbc-url: jdbc:mysql://dev.db.java110.com:3306/hc_community?useUnicode=true&characterEncoding=utf-8 username: hc_community password: hc_community@12345678 minIdle: 5 validationQuery: SELECT 1 FROM DUAL initialSize: 5 maxWait: 60000 filters: stat,wall,log4j poolPreparedStatements: true ds_master_1: driver-class-name: com.mysql.jdbc.Driver type: com.alibaba.druid.pool.DruidDataSource jdbc-url: jdbc:mysql://dev.db.java110.com:3306/TT?useUnicode=true&characterEncoding=utf-8 username: TT password: TT@12345678 minIdle: 5 validationQuery: SELECT 1 FROM DUAL initialSize: 5 maxWait: 60000 filters: stat,wall,log4j poolPreparedStatements: true sharding: tables: business_community: actual-data-nodes: ds_master_$->{0..1}.business_community database-strategy: inline: sharding-column: community_id algorithm-expression: ds_master_$->{Long.parseLong(community_id) % 2} community: actual-data-nodes: ds_master_$->{0..1}.community database-strategy: inline: sharding-column: community_id algorithm-expression: ds_master_$->{Long.parseLong(community_id) % 2} default-database-strategy: none: default-table-strategy: none: default-datasource-name: ds_master_0 # master-slave-rules: # ds_1: # slave-data-source-names: ds_master_1_slave_0, ds_master_1_slave_1 # master-data-source-name: ds_master_1 # ds_0: # slave-data-source-names: ds_master_0_slave_0, ds_master_0_slave_1 # master-data-source-name: ds_master_0