You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@shardingsphere.apache.org by "huang-xuan (via GitHub)" <gi...@apache.org> on 2024/11/06 09:54:28 UTC

[I] 5.5.0 自定义分片建异常. [shardingsphere]

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: notifications-unsubscribe@shardingsphere.apache.org.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [I] Shardingsphere version:5.5.0 Custom sharding exception. [shardingsphere]

Posted by "huang-xuan (via GitHub)" <gi...@apache.org>.
huang-xuan commented on issue #33567:
URL: https://github.com/apache/shardingsphere/issues/33567#issuecomment-2459232736

   > @strongduanmu Can you help me troubleshoot this problem? Thank you. I hope the documentation can be more complete and support configuration of various scenarios, so that it will be more friendly to novices.
   
   Thank you, I have solved it, but I still hope the documentation can be improved. I believe it will be of great help to novices.


-- 
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: notifications-unsubscribe@shardingsphere.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [I] Shardingsphere version:5.5.0 Custom sharding exception. [shardingsphere]

Posted by "huang-xuan (via GitHub)" <gi...@apache.org>.
huang-xuan commented on issue #33567:
URL: https://github.com/apache/shardingsphere/issues/33567#issuecomment-2459405431

   I have solved it.


-- 
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: notifications-unsubscribe@shardingsphere.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [I] 5.5.0 自定义分片建异常. [shardingsphere]

Posted by "huang-xuan (via GitHub)" <gi...@apache.org>.
huang-xuan commented on issue #33567:
URL: https://github.com/apache/shardingsphere/issues/33567#issuecomment-2459176746

   @strongduanmu 
   你能帮助我排查这个问题吗,谢谢,希望文档能更完善一些,支持各种场景的配置,这样对新手比较友好些.


-- 
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: notifications-unsubscribe@shardingsphere.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [I] Shardingsphere version:5.5.0 Custom sharding exception. [shardingsphere]

Posted by "huang-xuan (via GitHub)" <gi...@apache.org>.
huang-xuan closed issue #33567: Shardingsphere version:5.5.0 Custom sharding exception.
URL: https://github.com/apache/shardingsphere/issues/33567


-- 
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: notifications-unsubscribe@shardingsphere.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [I] Shardingsphere version:5.5.0 Custom sharding exception. [shardingsphere]

Posted by "huang-xuan (via GitHub)" <gi...@apache.org>.
huang-xuan closed issue #33567: Shardingsphere version:5.5.0 Custom sharding exception.
URL: https://github.com/apache/shardingsphere/issues/33567


-- 
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: notifications-unsubscribe@shardingsphere.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org