You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@shardingsphere.apache.org by GitBox <gi...@apache.org> on 2022/09/13 03:46:35 UTC

[GitHub] [shardingsphere] 726411951 opened a new issue, #20951: How to implement sharding algorithm in version 5.2.0

726411951 opened a new issue, #20951:
URL: https://github.com/apache/shardingsphere/issues/20951

   ## Question
   
   **For English only**, other languages will not accept.
   
   Before asking a question, make sure you have:
   
   - Googled your question.
   - Searched open and closed [GitHub issues](https://github.com/apache/shardingsphere/issues).
   - Read documentation: [ShardingSphere Doc](https://shardingsphere.apache.org/document/current/en/overview).
   
   Please pay attention on issues you submitted, because we maybe need more details. 
   If no response anymore and we cannot reproduce it on current information, we will **close it**.
   
   For our business, I implement sharding algorithm by using Java code,and the version is 5.1.1,the class is 
   ![image](https://user-images.githubusercontent.com/32379580/189801857-7fab8872-0be8-47b4-a5c0-ffea596a1a66.png)
   
   But when I update version to 5.2.0, This project can not run and the error is `[org/apache/shardingsphere/spring/boot/ShardingSphereAutoConfiguration.class]: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [javax.sql.DataSource]: Factory method 'shardingSphereDataSource' threw exception; nested exception is java.lang.IllegalArgumentException: Type is required.`
   
   I dont konw how to work it by changing my code , or may be can use this property [Class Based Sharding Algorithm
   ](https://shardingsphere.apache.org/document/current/en/user-manual/common-config/builtin-algorithm/sharding/#class-based-sharding-algorithm) instands of the code. I'm not sure, thanks for your answer


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


[GitHub] [shardingsphere] linghengqian commented on issue #20951: How to implement sharding algorithm in version 5.2.0

Posted by GitBox <gi...@apache.org>.
linghengqian commented on issue #20951:
URL: https://github.com/apache/shardingsphere/issues/20951#issuecomment-1250111937

   - Can you make a minimal reproducible example using h2database?  The configuration you gave is not complete, I tried to verify it locally and it was successful. 


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


[GitHub] [shardingsphere] 726411951 commented on issue #20951: How to implement sharding algorithm in version 5.2.0

Posted by GitBox <gi...@apache.org>.
726411951 commented on issue #20951:
URL: https://github.com/apache/shardingsphere/issues/20951#issuecomment-1244927782

   @strongduanmu  almost like 
   ```
   spring.shardingsphere.datasource.names=ds0,ds1
   
   spring.shardingsphere.datasource.ds0.type=com.zaxxer.hikari.HikariDataSource
   spring.shardingsphere.datasource.ds0.driver-class-name=com.mysql.cj.jdbc.Driver
   spring.shardingsphere.datasource.ds0.jdbc-url=jdbc:mysql://192.168.0.1:3306/oms_base0?autoReconnect=true&useUnicode=true&characterEncoding=utf8&useSSL=false&allowMultiQueries=true&serverTimezone=Asia/Shanghai
   spring.shardingsphere.datasource.ds0.username=root
   spring.shardingsphere.datasource.ds0.password=xxx
   
   spring.shardingsphere.datasource.ds1.type=com.zaxxer.hikari.HikariDataSource
   spring.shardingsphere.datasource.ds1.driver-class-name=com.mysql.cj.jdbc.Driver
   spring.shardingsphere.datasource.ds1.jdbc-url=jdbc:mysql://192.168.0.1:3306/oms_base1?autoReconnect=true&useUnicode=true&characterEncoding=utf8&useSSL=false&allowMultiQueries=true&serverTimezone=Asia/Shanghai
   spring.shardingsphere.datasource.ds1.username=root
   spring.shardingsphere.datasource.ds1.password=xxx
   
   spring.shardingsphere.rules.sharding.tables.oms_biz_order.database-strategy.standard.sharding-column=merchant_id
   spring.shardingsphere.rules.sharding.tables.oms_biz_order.database-strategy.standard.sharding-algorithm-name=shardingAlgorithmConfig
   
   spring.shardingsphere.rules.sharding.tables.oms_detail.database-strategy.standard.sharding-column=merchant_id
   spring.shardingsphere.rules.sharding.tables.oms_detail.database-strategy.standard.sharding-algorithm-name=shardingAlgorithmConfig
   ```
   
   


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


[GitHub] [shardingsphere] 726411951 commented on issue #20951: How to implement sharding algorithm in version 5.2.0

Posted by GitBox <gi...@apache.org>.
726411951 commented on issue #20951:
URL: https://github.com/apache/shardingsphere/issues/20951#issuecomment-1251923901

   @linghengqian So cooooool ! It's very helpful to me :satisfied: I 


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


[GitHub] [shardingsphere] strongduanmu commented on issue #20951: How to implement sharding algorithm in version 5.2.0

Posted by GitBox <gi...@apache.org>.
strongduanmu commented on issue #20951:
URL: https://github.com/apache/shardingsphere/issues/20951#issuecomment-1244865047

   @726411951 Thank you for your feedback. Can you provide your sharding configuration?


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


[GitHub] [shardingsphere] Ryoui commented on issue #20951: How to implement sharding algorithm in version 5.2.0

Posted by GitBox <gi...@apache.org>.
Ryoui commented on issue #20951:
URL: https://github.com/apache/shardingsphere/issues/20951#issuecomment-1246328388

   @726411951 请问解决了吗


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


[GitHub] [shardingsphere] 726411951 commented on issue #20951: How to implement sharding algorithm in version 5.2.0

Posted by GitBox <gi...@apache.org>.
726411951 commented on issue #20951:
URL: https://github.com/apache/shardingsphere/issues/20951#issuecomment-1246333356

   @Ryoui not yet


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


[GitHub] [shardingsphere] 726411951 commented on issue #20951: How to implement sharding algorithm in version 5.2.0

Posted by GitBox <gi...@apache.org>.
726411951 commented on issue #20951:
URL: https://github.com/apache/shardingsphere/issues/20951#issuecomment-1250354663

   @linghengqian Hi, this is the demo and run successfully on version 5.1.1
   [demo](https://github.com/726411951/sharding-database-demo)


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


[GitHub] [shardingsphere] linghengqian commented on issue #20951: How to implement sharding algorithm in version 5.2.0

Posted by GitBox <gi...@apache.org>.
linghengqian commented on issue #20951:
URL: https://github.com/apache/shardingsphere/issues/20951#issuecomment-1251887209

   @726411951 
   - I found out that this is nothing but your configuration issue. Your configuration is very confusing. 🤷‍♂️
   - Refer to https://github.com/linghengqian/sharding-database-demo/commit/ae37f388bda6a282623f1b3aedc19d8b7446ed1c.


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


[GitHub] [shardingsphere] 726411951 closed issue #20951: How to implement sharding algorithm in version 5.2.0

Posted by GitBox <gi...@apache.org>.
726411951 closed issue #20951: How to implement sharding algorithm in version 5.2.0
URL: https://github.com/apache/shardingsphere/issues/20951


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