fengying-wzm commented on issue #10290: URL: https://github.com/apache/shardingsphere/issues/10290#issuecomment-836642149
我的放在Apollo,是properties格式,你转一下。 ```properties # 是否启动读写分离 spring.shardingsphere.enabled = true # 主库配置 spring.shardingsphere.datasource.common.driver-class-name = com.mysql.cj.jdbc.Driver spring.shardingsphere.datasource.common.type = com.zaxxer.hikari.HikariDataSource spring.shardingsphere.datasource.names = master,slave0,slave1 spring.shardingsphere.datasource.master.jdbcUrl = jdbc:mysql://xxx:3306/xxx?useUnicode=true&characterEncoding=utf-8&useSSL=false&serverTimezone=GMT%2B8 spring.shardingsphere.datasource.master.username = xxx spring.shardingsphere.datasource.master.password = xxx spring.shardingsphere.datasource.master.minimum-idle = 20 spring.shardingsphere.datasource.master.maximum-pool-size = 50 spring.shardingsphere.datasource.master.auto-commit = true spring.shardingsphere.datasource.master.idle-timeout = 30000 spring.shardingsphere.datasource.master.max-lifetime = 1800000 spring.shardingsphere.datasource.master.connection-timeout = 30000 spring.shardingsphere.datasource.master.connection-test-query = SELECT 1 # 从库slave0 spring.shardingsphere.datasource.slave0.jdbcUrl = jdbc:mysql://xxx:3306/xxx?useUnicode=true&characterEncoding=utf-8&useSSL=false&serverTimezone=GMT%2B8 spring.shardingsphere.datasource.slave0.username = xxx spring.shardingsphere.datasource.slave0.password = xxx spring.shardingsphere.datasource.slave0.minimum-idle = 20 spring.shardingsphere.datasource.slave0.maximum-pool-size = 50 spring.shardingsphere.datasource.slave0.auto-commit = true spring.shardingsphere.datasource.slave0.idle-timeout = 30000 spring.shardingsphere.datasource.slave0.max-lifetime = 1800000 spring.shardingsphere.datasource.slave0.connection-timeout = 30000 spring.shardingsphere.datasource.slave0.connection-test-query = SELECT 1 # 从库slave1 spring.shardingsphere.datasource.slave1.jdbcUrl = jdbc:mysql://xxx:3306/xxx?useUnicode=true&characterEncoding=utf-8&useSSL=false&serverTimezone=GMT%2B8 spring.shardingsphere.datasource.slave1.username = xxx spring.shardingsphere.datasource.slave1.password = xxx spring.shardingsphere.datasource.slave1.minimum-idle = 20 spring.shardingsphere.datasource.slave1.maximum-pool-size = 50 spring.shardingsphere.datasource.slave1.auto-commit = true spring.shardingsphere.datasource.slave1.idle-timeout = 30000 spring.shardingsphere.datasource.slave1.max-lifetime = 1800000 spring.shardingsphere.datasource.slave1.connection-timeout = 30000 spring.shardingsphere.datasource.slave1.connection-test-query = SELECT 1 # 负载均衡算法,默认轮询 spring.shardingsphere.masterslave.load-balance-algorithm-type = round_robin spring.shardingsphere.masterslave.name = master-slave spring.shardingsphere.masterslave.master-data-source-name = master spring.shardingsphere.masterslave.slave-data-source-names = slave0,slave1 # 打印mysql语句 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. For queries about this service, please contact Infrastructure at: us...@infra.apache.org