zjcnb edited a comment on issue #11293:
URL:
https://github.com/apache/shardingsphere/issues/11293#issuecomment-878397240
hi, First adjust the content of the question to English Please!Then You can
use:
spring.shardingsphere.datasource.names=ds0,ds1
spring.shardingsphere.datasource.common.driver-class-name=com.mysql.jdbc.Driver
spring.shardingsphere.datasource.ds0.username=root
spring.shardingsphere.datasource.ds0.password=123456
spring.shardingsphere.datasource.ds0.url=jdbc:mysql://127.0.0.1:3306/ainewssystem_cloud_0?useUnicode=true&characterEncoding=utf-8&useSSL=false&serverTimezone=GMT%2b8
spring.shardingsphere.datasource.ds0.type=com.alibaba.druid.pool.DruidDataSource
spring.shardingsphere.datasource.ds1.username=root
spring.shardingsphere.datasource.ds1.password=123456
spring.shardingsphere.datasource.ds1.url=jdbc:mysql://127.0.0.1:3306/ainewssystem_cloud_1?useUnicode=true&characterEncoding=utf-8&useSSL=false&serverTimezone=GMT%2b8
spring.shardingsphere.datasource.ds1.type=com.alibaba.druid.pool.DruidDataSource
spring.shardingsphere.rules.sharding.sharding-algorithms.table-inline.type=INLINE
spring.shardingsphere.rules.sharding.sharding-algorithms.table-inline.props.algorithm-expression=ainews_user_$->{user_id
% 2}
spring.shardingsphere.rules.sharding.sharding-algorithms.database-inline.type=INLINE
spring.shardingsphere.rules.sharding.sharding-algorithms.database-inline.props.algorithm-expression=ds$->{user_id
% 2}
spring.shardingsphere.rules.sharding.tables.ainews_user_.actual-data-nodes=ds$->{0..1}.ainews_user_$->{0..1}
spring.shardingsphere.rules.sharding.tables.ainews_user_.database-strategy.standard.sharding-column=user_id
spring.shardingsphere.rules.sharding.tables.ainews_user_.database-strategy.standard.sharding-algorithm-name=database-inline
spring.shardingsphere.rules.sharding.tables.ainews_user_.table-strategy.standard.sharding-column=user_id
spring.shardingsphere.rules.sharding.tables.ainews_user_.table-strategy.standard.sharding-algorithm-name=table-inline
spring.shardingsphere.rules.sharding.key-generators.snowflake.type=SNOWFLAKE
spring.shardingsphere.rules.sharding.key-generators.snowflake.props.worker-id=123
##查看sql的输出日志
spring.shardingsphere.props.sql.show=true
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]