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/01 13:45:33 UTC

[GitHub] [shardingsphere] joychen1579 opened a new issue, #20717: 雪花算法生成的值余数只有 0 和 1

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

   ##全局配制单机模式启动   一般用于ShardingSphere-
     shardingsphere:
       mode:
         type: Memory
   #      type: Standalone
   #      repository:
   #        type: File
   #        props:
   #          path: .shardingsphere
   #      overwrite: false
   
   #一、
       datasource:
         names: m1
         m1:
           jdbc-url: jdbc:mysql://127.0.0.1:3306/joy_sharding_order?serverTimezone=UTC&useSSL=false&useUnicode=true&characterEncoding=UTF-8
           type: com.zaxxer.hikari.HikariDataSource
           driver-class-name: com.mysql.jdbc.Driver
           username: root
           password: joy123
       rules:
         sharding:
           tables:
             t_order:
               #说明表的分片数
               actual-data-nodes: m1.t_order$->{0..3}
               #表分片规则
               table-strategy:
                 standard:
                   #指定分片列
                   sharding-column: order_id
                   #给此分片列规则取名,方便在配制路由规则时时行匹配
                   sharding-algorithm-name: t-order-inline
                   #指定id生成列并指定生成列取一个 生成规则名,方便在配制具体生成规则时跟据对应名称进行生成
               key-generate-strategy:
                 column: order_id
                 key-generator-name: order-id-build
   
           sharding-algorithms:
             t-order-inline:
               type: INLINE
               props:
                 algorithm-expression: t_order$->{order_id % 4}
           key-generators:
             order-id-build:
               type: SNOWFLAKE
               props:
                 worker‐id: 1234
                 
    数据库中生成的值是:
    
   <img width="555" alt="image" src="https://user-images.githubusercontent.com/20336122/187929475-70fca2ae-4d1b-4515-a895-86e79a4214ed.png">
   <img width="490" alt="image" src="https://user-images.githubusercontent.com/20336122/187929540-a62f037f-db39-4d06-b1bd-ff844294382b.png">
   <img width="428" alt="image" src="https://user-images.githubusercontent.com/20336122/187929571-433216cb-eb5b-4265-9224-7e50f81abf94.png">
   <img width="488" alt="image" src="https://user-images.githubusercontent.com/20336122/187929614-9895ce28-e66a-4aa1-8645-da67748510c0.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] joychen1579 commented on issue #20717: 雪花算法生成的值余数只有 0 和 1

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

   It's written by mybatisplus


-- 
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] terrymanu closed issue #20717: 雪花算法生成的值余数只有 0 和 1

Posted by GitBox <gi...@apache.org>.
terrymanu closed issue #20717: 雪花算法生成的值余数只有 0  和  1
URL: https://github.com/apache/shardingsphere/issues/20717


-- 
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] TeslaCN commented on issue #20717: 雪花算法生成的值余数只有 0 和 1

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

   For English only. Please translate your issue into English.


-- 
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] terrymanu commented on issue #20717: 雪花算法生成的值余数只有 0 和 1

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

   **For English only**, other languages will not accept.


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