Cindyxin228 commented on issue #28014:
URL: 
https://github.com/apache/shardingsphere/issues/28014#issuecomment-1673109634

   > Hi @Cindyxin228 , what's your sharding_db configuration (dataSources and 
rules)?
   
   '''
   databaseName: sharding_db
   
   dataSources:
     ds_0:
       url: 
jdbc:mysql://127.0.0.1:3306/demo_ds_0?serverTimezone=UTC&useSSL=false
       username: root
       password: 123456
       connectionTimeoutMilliseconds: 30000
       idleTimeoutMilliseconds: 60000
       maxLifetimeMilliseconds: 1800000
       maxPoolSize: 50
       minPoolSize: 1
     ds_1:
       url: 
jdbc:mysql://127.0.0.1:3306/demo_ds_1?serverTimezone=UTC&useSSL=false
       username: root
       password: 123456
       connectionTimeoutMilliseconds: 30000
       idleTimeoutMilliseconds: 60000
       maxLifetimeMilliseconds: 1800000
       maxPoolSize: 50
       minPoolSize: 1
   
   
   rules:
   - !SHARDING
    tables:
      students:
        actualDataNodes: ds_${0..1}.students_${0..1}
        tableStrategy:
          standard:
            shardingColumn: order_id
            shardingAlgorithmName: students_inline
        keyGenerateStrategy:
          column: order_id
          keyGeneratorName: snowflake
      student_skill:
        actualDataNodes: ds_${0..1}.student_skill_${0..1}
        tableStrategy:
          standard:
            shardingColumn: order_item_id
            shardingAlgorithmName: student_skill_inline
        keyGenerateStrategy:
          column: order_item_id
          keyGeneratorName: snowflake
      website:
        actualDataNodes: ds_${0..1}.website_${0..1}
        tableStrategy:
          standard:
            shardingColumn: web_id
            shardingAlgorithmName: website_inline
        keyGenerateStrategy:
          column: web_id
          keyGeneratorName: snowflake
      new_web:
        actualDataNodes: ds_${0..1}.new_web_${0..1}
        tableStrategy:
          standard:
            shardingColumn: new_web_id
            shardingAlgorithmName: new_web_inline
        keyGenerateStrategy:
          column: new_web_id
          keyGeneratorName: snowflake
    bindingTables:
      - students,student_skill,website,new_web
    defaultDatabaseStrategy:
      standard:
        shardingColumn: user_id
        shardingAlgorithmName: database_inline
    defaultTableStrategy:
      none:
    
   
    shardingAlgorithms:
      database_inline:
        type: INLINE
        props:
          algorithm-expression: ds_${user_id % 2}
      students_inline:
        type: INLINE
        props:
          algorithm-expression: students_${order_id % 2}
      student_skill_inline:
        type: INLINE
        props:
          algorithm-expression: student_skill_${order_item_id % 2}
      website_inline:
        type: INLINE
        props:
          algorithm-expression: website_${web_id % 2}
      new_web_inline:
        type: INLINE
        props:
          algorithm-expression: new_web_${new_web_id % 2}
   
    keyGenerators:
      snowflake:
        type: SNOWFLAKE
   
   
   '''


-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to