Comven removed a comment on issue #10127:
URL: 
https://github.com/apache/shardingsphere/issues/10127#issuecomment-906198995


   We use properties to configured readwrite-splitting. 
   ```
   spring.shardingsphere.props.sql-show=true
   spring.shardingsphere.datasource.names=db1,db1slaver
   
spring.shardingsphere.datasource.db1.jdbc-url=jdbc:mysql://localhost:3306/db_master?useUnicode=true&characterEncoding=UTF-8&zeroDateTimeBehavior=convertToNull&useSSL=false&reconnect=true&serverTimezone=Asia/Shanghai
   spring.shardingsphere.datasource.db1.username=root
   spring.shardingsphere.datasource.db1.password=
   spring.shardingsphere.datasource.db1.type=com.zaxxer.hikari.HikariDataSource
   
spring.shardingsphere.datasource.db1.driver-class-name=com.mysql.cj.jdbc.Driver
   
   
spring.shardingsphere.datasource.db1slaver.jdbc-url=jdbc:mysql://localhost:3306/db_slaver?useUnicode=true&characterEncoding=UTF-8&zeroDateTimeBehavior=convertToNull&useSSL=false&reconnect=true&serverTimezone=Asia/Shanghai
   spring.shardingsphere.datasource.db1slaver.username=root
   spring.shardingsphere.datasource.db1slaver.password=
   
spring.shardingsphere.datasource.db1slaver.type=com.zaxxer.hikari.HikariDataSource
   
spring.shardingsphere.datasource.db1slaver.driver-class-name=com.mysql.cj.jdbc.Driver
   # readwrite-splitting like this
   
spring.shardingsphere.rules.readwrite-splitting.dataSources.group1.writeDataSourceName=db1
   
spring.shardingsphere.rules.readwrite-splitting.dataSources.group1.readDataSourceNames=db1slaver
   
spring.shardingsphere.rules.readwrite-splitting.dataSources.group1.load-balancer-name=roundRobin
   ```
   the `db1` has 7 records, the `db1slaver` has 4 records.
   It doesn't work,executing a query statement always returns 7 records. When I 
configure it like this
   ```
   
spring.shardingsphere.rules.readwrite-splitting.dataSources.db1.writeDataSourceName=db1
   
spring.shardingsphere.rules.readwrite-splitting.dataSources.db1.readDataSourceNames=db1slaver
   
spring.shardingsphere.rules.readwrite-splitting.dataSources.db1.load-balancer-name=roundRobin
   ```
   `goup1` change to `db1`, it work fine. 
   
   And when I use the Java API to configure it, it also doesn't work unless 
`goup1` is replaced by `db1`. what's wrong with my code?


-- 
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]


Reply via email to