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 2021/12/07 00:54:40 UTC

[GitHub] [shardingsphere] happyi opened a new issue #13960: the ShardingAlgorithm disagree in sharding-jdbc and sharding-proxy

happyi opened a new issue #13960:
URL: https://github.com/apache/shardingsphere/issues/13960


   ## Bug Report
   
   ### Which version of ShardingSphere did you use?
   sharding-jdbc:5.0.0
   sharding-proxy:5.0.0 
   ### Which project did you use? ShardingSphere-JDBC or ShardingSphere-Proxy?
   both 
   ### Expected behavior
   
   get the same table in sharding-jdbc and  sharding-proxy
   
   ### Actual behavior
   the config is the same as follow
   
   ```
   dataSources:
     ds_0:
       url: jdbc:mysql://192.168.1.101:3306/test_db?useUnicode=true&characterEncoding=utf-8
       username: root
       password: 123456
     ds_1:
       url: jdbc:mysql://192.168.1.102:3306/test_db?useUnicode=true&characterEncoding=utf-8
       username: root
       password:123456
   #
   rules:
   - !SHARDING
     tables:
       s_customer_asset:
         actualDataNodes: ds_${0..1}.nx_customer_asset_s${0..7}
         databaseStrategy:
           standard:
             shardingColumn: customer_id
             shardingAlgorithmName: db_sharding_algorithm
         tableStrategy:
           standard:
             shardingColumn: customer_id
             shardingAlgorithmName: table_sharding_algorithm
     shardingAlgorithms:
        db_sharding_algorithm:
           type: HASH_MOD
           props:
              sharding-count: 2
        table_sharding_algorithm:
           type: HASH_MOD
           props:
              sharding-count: 8
   ```
   2 database and 8 table  at the sharding-jdbc it will get  
   ```
   ds_0.nx_customer_asset_s0
   ds_0.nx_customer_asset_s1
   ds_0.nx_customer_asset_s2
   ds_0.nx_customer_asset_s3
   ds_1.nx_customer_asset_s0
   ds_1.nx_customer_asset_s1
   ds_1.nx_customer_asset_s2
   ds_1.nx_customer_asset_s3
   ```
   
   2 database and 8 table  at the sharding-proxy it will get  
   ```
   ds_0.nx_customer_asset_s0
   ds_0.nx_customer_asset_s2
   ds_0.nx_customer_asset_s4
   ds_0.nx_customer_asset_s6
   ds_1.nx_customer_asset_s1
   ds_1.nx_customer_asset_s3
   ds_1.nx_customer_asset_s5
   ds_1.nx_customer_asset_s7
   ```
   
   
   
   


-- 
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] happyi commented on issue #13960: the ShardingAlgorithm disagree in sharding-jdbc and sharding-proxy

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


   i emphasize  that  the auto table isn't get the expect result


-- 
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] happyi commented on issue #13960: the ShardingAlgorithm disagree in sharding-jdbc and sharding-proxy

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


   > Hi @happyi, I noticed that you are using the automatic sharding algorithm. The automatic sharding algorithm cannot be configured in the tables attribute. Please refer to the documentation for the correct configuration method——https://shardingsphere.apache.org/document/current/cn/user-manual/shardingsphere-jdbc/yaml-config/rules/sharding/.
   > 
   > ```yaml
   > rules:
   > - !SHARDING
   >   autoTables: # 自动分片表规则配置
   >     t_order_auto: # 逻辑表名称
   >       actualDataSources (?): # 数据源名称
   >       shardingStrategy: # 切分策略
   >         standard: # 用于单分片键的标准分片场景
   >           shardingColumn: # 分片列名称
   >           shardingAlgorithmName: # 自动分片算法名称
   > ```
   
   what's mean of autoTables?
   


-- 
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] happyi commented on issue #13960: the ShardingAlgorithm disagree in sharding-jdbc and sharding-proxy

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


   please attention the  suffix of the Actual table。


-- 
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] happyi commented on issue #13960: the ShardingAlgorithm disagree in sharding-jdbc and sharding-proxy

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


   > @happyi First of all you have to use the correct configuration, your configuration is currently wrong. The official document gives a correct configuration example, so please adjust the configuration and check if there is a problem.
   
   please attention the suffix of the Actual table。


-- 
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 #13960: the ShardingAlgorithm disagree in sharding-jdbc and sharding-proxy

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


   @happyi `autoTable` refers to a table that can be automatically sharding, and you don't need to specify actualDataNodes. 
   
   Judging from your response, you may have used autoTable by mistake. I suggest you refer to the [official example](https://github.com/apache/shardingsphere/tree/master/examples/shardingsphere-jdbc-example/single-feature-example/sharding-example), which provides many examples of sharding.


-- 
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 #13960: the ShardingAlgorithm disagree in sharding-jdbc and sharding-proxy

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


   Hi @happyi, I noticed that you are using the automatic sharding algorithm. The automatic sharding algorithm cannot be configured in the tables attribute. Please refer to the documentation for the correct configuration method——https://shardingsphere.apache.org/document/current/cn/user-manual/shardingsphere-jdbc/yaml-config/rules/sharding/.
   
   ```yaml
   rules:
   - !SHARDING
     autoTables: # 自动分片表规则配置
       t_order_auto: # 逻辑表名称
         actualDataSources (?): # 数据源名称
         shardingStrategy: # 切分策略
           standard: # 用于单分片键的标准分片场景
             shardingColumn: # 分片列名称
             shardingAlgorithmName: # 自动分片算法名称
   ```


-- 
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] happyi commented on issue #13960: the ShardingAlgorithm disagree in sharding-jdbc and sharding-proxy

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


   > @happyi First of all you have to use the correct configuration, your configuration is currently wrong. The official document gives a correct configuration example, so please adjust the configuration and check if there is a problem.
   
   the auto table  can't get expected result  like :
   
   ds_0.nx_customer_asset_s0
   ds_0.nx_customer_asset_s2
   ds_0.nx_customer_asset_s4
   ds_0.nx_customer_asset_s6
   ds_1.nx_customer_asset_s1
   ds_1.nx_customer_asset_s3
   ds_1.nx_customer_asset_s5
   ds_1.nx_customer_asset_s7


-- 
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] happyi commented on issue #13960: the ShardingAlgorithm disagree in sharding-jdbc and sharding-proxy

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


   > @happyi `autoTable` refers to a table that can be automatically sharding, and you don't need to specify actualDataNodes.
   > 
   > Judging from your response, you may have used autoTable by mistake. I suggest you refer to the [official example](https://github.com/apache/shardingsphere/tree/master/examples/shardingsphere-jdbc-example/single-feature-example/sharding-example), which provides many examples of sharding.
   
   the config Above is   shardingSphere-Proxy 。how shardingSphere-jdbc  can get the same behavior?


-- 
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] happyi edited a comment on issue #13960: the ShardingAlgorithm disagree in sharding-jdbc and sharding-proxy

Posted by GitBox <gi...@apache.org>.
happyi edited a comment on issue #13960:
URL: https://github.com/apache/shardingsphere/issues/13960#issuecomment-987687215


   > @happyi First of all you have to use the correct configuration, your configuration is currently wrong. The official document gives a correct configuration example, so please adjust the configuration and check if there is a problem.
   
   the auto table  can't get expected result  like :
   logic talbe   : nx_customer_asset
   Actual table:
   
   ds_0.nx_customer_asset_s0
   ds_0.nx_customer_asset_s2
   ds_0.nx_customer_asset_s4
   ds_0.nx_customer_asset_s6
   ds_1.nx_customer_asset_s1
   ds_1.nx_customer_asset_s3
   ds_1.nx_customer_asset_s5
   ds_1.nx_customer_asset_s7


-- 
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] happyi commented on issue #13960: the ShardingAlgorithm disagree in sharding-jdbc and sharding-proxy

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


   > @happyi Please read the [document](https://shardingsphere.apache.org/document/current/cn/user-manual/shardingsphere-jdbc/spring-boot-starter/rules/sharding/) carefully, there are detailed instructions and examples for the configuration of autoTable.
   
   i hava read the example and try it  。  however there haven't  i want 。
   
   how the sharding-proxy get the same behavior like sharding-jdbc?


-- 
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] happyi removed a comment on issue #13960: the ShardingAlgorithm disagree in sharding-jdbc and sharding-proxy

Posted by GitBox <gi...@apache.org>.
happyi removed a comment on issue #13960:
URL: https://github.com/apache/shardingsphere/issues/13960#issuecomment-989338901


   please attention the  suffix of the Actual table。


-- 
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 #13960: the ShardingAlgorithm disagree in sharding-jdbc and sharding-proxy

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


   @happyi Please read the [document](https://shardingsphere.apache.org/document/current/cn/user-manual/shardingsphere-jdbc/spring-boot-starter/rules/sharding/) carefully, there are detailed instructions and examples for the configuration of autoTable. 


-- 
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 #13960: the ShardingAlgorithm disagree in sharding-jdbc and sharding-proxy

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


   @happyi First of all you have to use the correct configuration, your configuration is currently wrong. The official document gives a correct configuration example, so please adjust the configuration and check if there is a problem.


-- 
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] happyi removed a comment on issue #13960: the ShardingAlgorithm disagree in sharding-jdbc and sharding-proxy

Posted by GitBox <gi...@apache.org>.
happyi removed a comment on issue #13960:
URL: https://github.com/apache/shardingsphere/issues/13960#issuecomment-987685492


   i emphasize  that  the auto table isn't get the expect result


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