gavinWithGu commented on issue #29386:
URL: 
https://github.com/apache/shardingsphere/issues/29386#issuecomment-1869544777

   @linghengqian 
   Now I am using the old version of sharding-jdbc: 4.0.1. The table sharding 
function works fine, then I tried to config the file mentioned in the link 
below to support read-write split, but it did not take effect. The select query 
always goes to the writer node
   
[user-manual_4.0.1](https://shardingsphere.apache.org/document/4.0.1/cn/user-manual/shardingsphere-jdbc/yaml-config/rules/readwrite-splitting/
   )
   
   **application-standardsharding.yml**
   ```
   spring:
     shardingsphere:
       datasource:
         names: db1, db2
         db1:
           type: com.zaxxer.hikari.HikariDataSource
           driver-class-name: com.mysql.cj.jdbc.Driver
           jdbc-url: jdbc:mysql://***/shardingsphere_1
           username: 123
           password: 123
         db2:
           type: com.zaxxer.hikari.HikariDataSource
           driver-class-name: com.mysql.cj.jdbc.Driver
           jdbc-url: jdbc:mysql://***/shardingsphere_2
           username: 123
           password: 123
       sharding:
         tables:
           student:
             actual-data-nodes: 
db1.tb_student_$->{1..3},db2.tb_student_$->{1..3}
             database-strategy:
               standard:
                 sharding-column: id
                 precise-algorithm-class-name: 
com.shardingsphere.sharding.jpa.algorithm.DatabasePreciseShardingAlgorithm
             table-strategy:
               standard:
                 sharding-column: id
                 precise-algorithm-class-name: 
com.shardingsphere.sharding.jpa.algorithm.TablePreciseShardingAlgorithm
       readwrite_splitting:
           dataSources:
             db:
               type: Static
               load-balancer-name: round_robin
               props:
                  write-data-source-name: db1
                  read-data-source-names: db2
           loadBalancers:
             round_robin:
               type: ROUND_ROBIN
   ```
   
   Github reporitory
   [sharding-jdbc-poc](https://github.com/gavinWithGu/sharding-jdbc-poc)
   
   Please check and provide the solution regarding how to enable the read-write 
split.
   
   Thanks a lot.


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