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 2020/09/07 10:34:51 UTC

[GitHub] [shardingsphere] dongfangding commented on issue #7269: The question about dataSourceNames only taking the last one after master-slave-rules is configured

dongfangding commented on issue #7269:
URL: https://github.com/apache/shardingsphere/issues/7269#issuecomment-688235597


   Yes, you are right, but in my case, I think it's necessary.
   
   About configuration, it like this.
   
   ```yaml
       sharding:
         default-data-source-name: master
         tables:
           auth_user:
             actual-data-nodes: master.auth_user,master.auth_user_1
             table-strategy:
               inline:
                 sharding-column: id
                 algorithm-expression: auth_user$->{id % 2 == 0 ? "":"_" + id % 2}
   
           user_article:
             userMasterSlaveRulesDatasourceNameIfExist: false
             actual-data-nodes: master.user_article,master.user_article_1,slave$->{0..1}.user_article,slave$->{0..1}.user_article_1
             database-strategy:
               standard:
                 sharding-column: user_id
                 preciseAlgorithmClassName: com.ddf.boot.quick.sharding.UserArticleDatabasePreciseShardingAlgorithm
   
             table-strategy:
               inline:
                 sharding-column: user_id
                 algorithm-expression: user_article$->{user_id % 2 == 0 ? "":"_" + user_id % 2}
   
         master-slave-rules:
           master:
             load-balance-algorithm-type: round_robin
             master-data-source-name: master
             slave-data-source-names: slave0,slave1
   ```


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