Closed jimforcode closed 5 years ago
i use sharding jdbc version 3.1.0 . springboot version 2.1.6 sharding-jdbc-spring-boot-starter 3.1.0
sharding-jdbc-spring-boot-starter 3.1.0
i found that . no matter i config broadcast-tables and binding-tables or not , it works well. i just wonder, does it really make some differents?
my configuration
mybatis.configuration.map-underscore-to-camel-case=true sharding.jdbc.datasource.names=ds0,ds1 sharding.jdbc.datasource.ds0.type=com.zaxxer.hikari.HikariDataSource sharding.jdbc.datasource.ds0.driver-class-name=com.mysql.cj.jdbc.Driver sharding.jdbc.datasource.ds0.jdbc-url=jdbc:mysql://localhost:3306/demo_ds_0?serverTimezone=UTC&useSSL=false&useUnicode=true&characterEncoding=UTF-8&allowPublicKeyRetrieval=true sharding.jdbc.datasource.ds0.username=root sharding.jdbc.datasource.ds0.password=123456 sharding.jdbc.datasource.ds1.type=com.zaxxer.hikari.HikariDataSource sharding.jdbc.datasource.ds1.driver-class-name=com.mysql.cj.jdbc.Driver sharding.jdbc.datasource.ds1.jdbc-url=jdbc:mysql://localhost:3306/demo_ds_1?serverTimezone=UTC&useSSL=false&useUnicode=true&characterEncoding=UTF-8&allowPublicKeyRetrieval=true sharding.jdbc.datasource.ds1.username=root sharding.jdbc.datasource.ds1.password=123456
sharding.jdbc.config.sharding.default-database-strategy.inline.sharding-column=user_id sharding.jdbc.config.sharding.default-database-strategy.inline.algorithm-expression=ds$->{user_id % 2}
sharding.jdbc.config.sharding.tables.order.actual-data-nodes=ds$->{0..1}.order$->{0..1}
sharding.jdbc.config.sharding.tables.order.table-strategy.inline.sharding-column=order_id
sharding.jdbc.config.sharding.tables.order.table-strategy.inline.algorithm-expression=order$->{order_id % 2}
sharding.jdbc.config.sharding.tables.order.key-generator-column-name=order_id sharding.jdbc.config.sharding.tables.order_item.actual-data-nodes=ds$->{0..1}.order_item$->{0..1} sharding.jdbc.config.sharding.tables.order_item.table-strategy.inline.sharding-column=order_id sharding.jdbc.config.sharding.tables.order_item.table-strategy.inline.algorithm-expression=order_item$->{order_id % 2} sharding.jdbc.config.sharding.tables.order_item.key-generator-column-name=order_item_id
sharding.jdbc.config.sharding.binding-tables=order,order_item
sharding.jdbc.config.props.sql.show=true
Can you change the title which to make this issue search friendly?
Will close soon if no response anymore.
i use sharding jdbc version 3.1.0 . springboot version 2.1.6
sharding-jdbc-spring-boot-starter 3.1.0
i found that . no matter i config broadcast-tables and binding-tables or not , it works well. i just wonder, does it really make some differents?
my configuration
mybatis.configuration.map-underscore-to-camel-case=true sharding.jdbc.datasource.names=ds0,ds1 sharding.jdbc.datasource.ds0.type=com.zaxxer.hikari.HikariDataSource sharding.jdbc.datasource.ds0.driver-class-name=com.mysql.cj.jdbc.Driver sharding.jdbc.datasource.ds0.jdbc-url=jdbc:mysql://localhost:3306/demo_ds_0?serverTimezone=UTC&useSSL=false&useUnicode=true&characterEncoding=UTF-8&allowPublicKeyRetrieval=true sharding.jdbc.datasource.ds0.username=root sharding.jdbc.datasource.ds0.password=123456 sharding.jdbc.datasource.ds1.type=com.zaxxer.hikari.HikariDataSource sharding.jdbc.datasource.ds1.driver-class-name=com.mysql.cj.jdbc.Driver sharding.jdbc.datasource.ds1.jdbc-url=jdbc:mysql://localhost:3306/demo_ds_1?serverTimezone=UTC&useSSL=false&useUnicode=true&characterEncoding=UTF-8&allowPublicKeyRetrieval=true sharding.jdbc.datasource.ds1.username=root sharding.jdbc.datasource.ds1.password=123456
sharding.jdbc.config.sharding.default-database-strategy.inline.sharding-column=user_id sharding.jdbc.config.sharding.default-database-strategy.inline.algorithm-expression=ds$->{user_id % 2}
sharding.jdbc.config.sharding.tables.order.actual-data-nodes=ds$->{0..1}.order$->{0..1}
sharding.jdbc.config.sharding.tables.order.table-strategy.inline.sharding-column=order_id
sharding.jdbc.config.sharding.tables.order.table-strategy.inline.algorithm-expression=order$->{order_id % 2}
sharding.jdbc.config.sharding.tables.order.key-generator-column-name=order_id sharding.jdbc.config.sharding.tables.order_item.actual-data-nodes=ds$->{0..1}.order_item$->{0..1} sharding.jdbc.config.sharding.tables.order_item.table-strategy.inline.sharding-column=order_id sharding.jdbc.config.sharding.tables.order_item.table-strategy.inline.algorithm-expression=order_item$->{order_id % 2} sharding.jdbc.config.sharding.tables.order_item.key-generator-column-name=order_item_id
here is the question
sharding.jdbc.config.sharding.binding-tables=order,order_item
sharding.jdbc.config.sharding.broadcast-tables=t_config
sharding.jdbc.config.props.sql.show=true