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 2019/07/29 09:57:31 UTC

[GitHub] [incubator-shardingsphere] Myshiner opened a new issue #2782: Sharding-proxy master-slave in sharding doesn't work

Myshiner opened a new issue #2782: Sharding-proxy master-slave in sharding doesn't work
URL: https://github.com/apache/incubator-shardingsphere/issues/2782
 
 
   I have configed master-slave separation in sharding, but actually when i take select operation it wasn't routed to slave node? why ? Here is my sharding configurations for your referance, any comments ?
   **datasource:**
   neworiental_answer: !!io.shardingsphere.orchestration.yaml.YamlDataSourceConfiguration
     dataSourceClassName: com.zaxxer.hikari.HikariDataSource
     properties:
       maxPoolSize: 50
       maintenanceIntervalMilliseconds: 30000
       url: jdbc:mysql://192.168.0.10:33060/neworiental_answer?serverTimezone=UTC&useSSL=false
       minPoolSize: 1
       idleTimeoutMilliseconds: 60000
       maxLifetimeMilliseconds: 1800000
       connectionTimeoutMilliseconds: 30000
       password: qq9527@xdf
       username: admin
   slave_answer_0: !!io.shardingsphere.orchestration.yaml.YamlDataSourceConfiguration
     dataSourceClassName: com.zaxxer.hikari.HikariDataSource
     properties:
       maxPoolSize: 50
       maintenanceIntervalMilliseconds: 30000
       url: jdbc:mysql://192.168.0.11:44060/neworiental_answer?serverTimezone=UTC&useSSL=false
       minPoolSize: 1
       idleTimeoutMilliseconds: 60000
       maxLifetimeMilliseconds: 0
       connectionTimeoutMilliseconds: 30000
       password: 1a2s3dqwe
       username: reader
   
   **rule:**
   bindingTables:
   - entity_stu_ques_knowledge,entity_student_error_exe,entity_student_exercise,cms_brush_questions_correct
   defaultKeyGeneratorClassName: io.shardingsphere.core.keygen.DefaultKeyGenerator
   masterSlaveRules:
     ms_answer:
       loadBalanceAlgorithmClassName: io.shardingsphere.api.algorithm.masterslave.RoundRobinMasterSlaveLoadBalanceAlgorithm
       masterDataSourceName: neworiental_answer
       name: ms_answer
       slaveDataSourceNames:
       - slave_answer_0
   tables:
     entity_stu_ques_knowledge:
       actualDataNodes: ms_answer.entity_stu_ques_knowledge_${0..99}
       keyGeneratorColumnName: id
       logicTable: entity_stu_ques_knowledge
       tableStrategy:
         inline:
           algorithmExpression: entity_stu_ques_knowledge_${student_id % 100}
           shardingColumn: student_id
     entity_student_error_exe:
       actualDataNodes: ms_answer.entity_student_error_exe_${0..99}
       keyGeneratorColumnName: id
       logicTable: entity_student_error_exe
       tableStrategy:
         inline:
           algorithmExpression: entity_student_error_exe_${student_id % 100}
           shardingColumn: student_id
     entity_student_exercise:
       actualDataNodes: ms_answer.entity_student_exercise_${2015..2019}_${0..49}
       keyGeneratorColumnName: id
       logicTable: entity_student_exercise
       tableStrategy:
         complex:
           algorithmClassName: io.shardingsphere.api.algorithm.sharding.complex.ComplexAnswerShardingAlgorithm
           shardingColumns: year,class_id,student_id        
     cms_brush_questions_correct:
       actualDataNodes: ms_answer.cms_brush_questions_correct
       logicTable: cms_brush_questions_correct
   
   
   Thx.
   

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services