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/08/04 02:26:21 UTC

[GitHub] [shardingsphere] xiaotong2019 opened a new issue, #19847: How can I use the VOLUME_RANGE algorithm type?

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

   ## How can I use the VOLUME_RANGE algorithm type?
   
   I am a novice user of the V5.1.2 framework and am currently encountering some confusion in usage.
   
   When I read the document VOLUME_RANGE: 
   https://shardingsphere.apache.org/document/5.1.2/cn/user-manual/shardingsphere-jdbc/builtin-algorithm/sharding/
   
   After that, the usage of the sample is not very familiar. 
   So, Pls help.. thanks.
   
   
   ## My configuration:
   
   server.port=8080
   
   mybatis-plus.mapper-locations=classpath:mybatis/**/*.xml
   mybatis-plus.type-aliases-package=com.catfish.**.domain
   mybatis-plus.configuration.map-underscore-to-camel-case=true
   
   spring.shardingsphere.enabled=true
   spring.shardingsphere.mode.type=Memory
   spring.shardingsphere.props.sql-show=true
   
   spring.shardingsphere.rules.sharding.key-generators.snowflake.type=SNOWFLAKE
   spring.shardingsphere.rules.sharding.key-generators.snowflake.props.worker-id=123
   
   spring.shardingsphere.datasource.names=ds0
   spring.shardingsphere.datasource.ds0.jdbc-url=jdbc:mysql://localhost:3306/ds0?serverTimezone=GMT%2B8&useSSL=false&useUnicode=true&characterEncoding=UTF-8
   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.username=root
   spring.shardingsphere.datasource.ds0.password=root1234
   spring.shardingsphere.datasource.ds0.minimum-idle=2
   spring.shardingsphere.datasource.ds0.maximum-pool-size=5
   
   spring.shardingsphere.rules.sharding.tables.t_order.actual-data-nodes=ds0.t_order_$->{0..1}
   spring.shardingsphere.rules.sharding.tables.t_order_item.actual-data-nodes=ds0.t_order_item_$->{0..1}
   spring.shardingsphere.rules.sharding.tables.t_user.actual-data-nodes=ds0.t_user_$->{0..1}
   
   spring.shardingsphere.rules.sharding.binding-tables=t_order,t_order_item
   spring.shardingsphere.rules.sharding.broadcast-tables=t_dict
   
   spring.shardingsphere.rules.sharding.tables.t_order.key-generate-strategy.column=order_id
   spring.shardingsphere.rules.sharding.tables.t_order.key-generate-strategy.key-generator-name=snowflake
   spring.shardingsphere.rules.sharding.tables.t_order_item.key-generate-strategy.column=item_id
   spring.shardingsphere.rules.sharding.tables.t_order_item.key-generate-strategy.key-generator-name=snowflake
   spring.shardingsphere.rules.sharding.tables.t_user.key-generate-strategy.column=user_id
   spring.shardingsphere.rules.sharding.tables.t_user.key-generate-strategy.key-generator-name=snowflake
   spring.shardingsphere.rules.sharding.tables.t_dict.key-generate-strategy.column=id
   spring.shardingsphere.rules.sharding.tables.t_dict.key-generate-strategy.key-generator-name=snowflake
   
   spring.shardingsphere.rules.sharding.tables.t_order.table-strategy.standard.sharding-column=order_id
   spring.shardingsphere.rules.sharding.tables.t_order.table-strategy.standard.sharding-algorithm-name=tb-order
   spring.shardingsphere.rules.sharding.tables.t_order_item.table-strategy.standard.sharding-column=order_id
   spring.shardingsphere.rules.sharding.tables.t_order_item.table-strategy.standard.sharding-algorithm-name=tb-order-item
   spring.shardingsphere.rules.sharding.tables.t_user.table-strategy.standard.sharding-column=user_id
   spring.shardingsphere.rules.sharding.tables.t_user.table-strategy.standard.sharding-algorithm-name= tb-user
   
   spring.shardingsphere.rules.sharding.sharding-algorithms.tb-order.type=VOLUME_RANGE
   spring.shardingsphere.rules.sharding.sharding-algorithms.tb-order.props.range-lower=0
   spring.shardingsphere.rules.sharding.sharding-algorithms.tb-order.props.range-upper=20
   spring.shardingsphere.rules.sharding.sharding-algorithms.tb-order.props.sharding-volume=10
   spring.shardingsphere.rules.sharding.sharding-algorithms.tb-order-item.type=VOLUME_RANGE
   spring.shardingsphere.rules.sharding.sharding-algorithms.tb-order-item.props.range-lower=0
   spring.shardingsphere.rules.sharding.sharding-algorithms.tb-order-item.props.range-upper=60
   spring.shardingsphere.rules.sharding.sharding-algorithms.tb-order-item.props.sharding-volume=30
   spring.shardingsphere.rules.sharding.sharding-algorithms.tb-user.type=VOLUME_RANGE
   spring.shardingsphere.rules.sharding.sharding-algorithms.tb-user.props.range-lower=0
   spring.shardingsphere.rules.sharding.sharding-algorithms.tb-user.props.range-upper=20
   spring.shardingsphere.rules.sharding.sharding-algorithms.tb-user.props.sharding-volume=10
   
   
   ![image](https://user-images.githubusercontent.com/110440830/182749676-f2b93a06-8f08-4379-a885-8e3e8931c1ff.png)
   
   


-- 
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] xiaotong2019 closed issue #19847: How can I use the VOLUME_RANGE algorithm type?

Posted by GitBox <gi...@apache.org>.
xiaotong2019 closed issue #19847: How can I use the VOLUME_RANGE algorithm type?
URL: https://github.com/apache/shardingsphere/issues/19847


-- 
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] xiaotong2019 commented on issue #19847: How can I use the VOLUME_RANGE algorithm type?

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

   Oh.., I found the cause of the problem, my sharding column cannot be the primary key, but should be other logical fields.
   thanks.


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