huang-xuan opened a new issue, #33567:
URL: https://github.com/apache/shardingsphere/issues/33567

   我想按照orderId,customerId 自定义数据分片,保证多个分片建查询能查到同一个数据.
   shardingsphere version:5.5.0
   
   
   dataSources:
     ds0:
       dataSourceClassName: com.zaxxer.hikari.HikariDataSource
       driverClassName: com.mysql.cj.jdbc.Driver
       jdbcUrl: 
jdbc:mysql://localhost:3306/demo_ds?serverTimezone=UTC&useSSL=false&useUnicode=true&characterEncoding=UTF-8
       username: root
       password: admin123
       poolName: test0
       minPoolSize: 2
       maxPoolSize: 20
     ds1:
       dataSourceClassName: com.zaxxer.hikari.HikariDataSource
       driverClassName: com.mysql.cj.jdbc.Driver
       jdbcUrl: 
jdbc:mysql://localhost:3306/demo_ds_0?serverTimezone=UTC&useSSL=false&useUnicode=true&characterEncoding=UTF-8
       username: root
       password: admin123
       poolName: test1
       minPoolSize: 5
       maxPoolSize: 20
     ds2:
       dataSourceClassName: com.zaxxer.hikari.HikariDataSource
       driverClassName: com.mysql.cj.jdbc.Driver
       jdbcUrl: 
jdbc:mysql://localhost:3306/demo_ds_1?serverTimezone=UTC&useSSL=false&useUnicode=true&characterEncoding=UTF-8
       username: root
       password: admin123
       poolName: test2
       minPoolSize: 5
       maxPoolSize: 20
   rules:
   #  - !SINGLE
   #    tables:
   #      - "*.order_*"
     - !READWRITE_SPLITTING
       dataSourceGroups:
         readwrite_ds:
           writeDataSourceName: ds0
           readDataSourceNames:
             - ds1
             - ds2
           loadBalancerName: ROUND_ROBIN
       loadBalancers:
         ROUND_ROBIN:
           type: ROUND_ROBIN
     - !SHARDING
   #    autoTables:
   #      order:
   #        actualDataSources: ds1,ds2
   #        shardingStrategy:
   #          standard:
   #            shardingColumn: order_id
   #            shardingAlgorithmName: auto_mod
       tables:
         order:
           actualDataNodes: readwrite_ds.order_${0..1}
           tableStrategy:
   #          standard:
   #            shardingColumn: order_id
   #            shardingAlgorithmName: order_inline
              complex:
                shardingColumns: order_id,customer_id
                shardingAlgorithmName: customer
       defaultTableStrategy:
         none:
       shardingAlgorithms:
         auto_mod:
           type: MOD
           props:
             sharding-count: 2
         order_inline:
           type: INLINE
           props:
             algorithm-expression: order_${order_id % 2}
         customer:
           type: CLASS_BASED
           props:
             strategy: COMPLEX
             algorithmClassName: 
com.example.demo.sharding.CustomerShardingAlgorithm
   props:
     sql-show: true
   
   
   
   
   error:
   
![image](https://github.com/user-attachments/assets/d48ded8a-1b5a-49a4-86b9-6d1e96e5c1ab)
   


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