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/06/17 02:32:12 UTC

[GitHub] [shardingsphere] skyjilygao opened a new issue, #18401: Configuring multiple data sources reports an error: the table does not exist

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

   English:
   Configure multiple data sources: DS1, ds1slave0, DS2, ds2slave0, DS3, DS4
   Only DS1 is configured with fragmentation rules, and DS1 and DS2 are configured with read / write separation; DS3 and DS4 are not configured.
   Question:
   dws_ shop_ The key table exists in DS3. Other DS do not have this table.
   But DWS is always read from DS2 during execution_ shop_ The key table indicates that there is no error in the table.
   Configuring multiple data sources reports an error: the table does not exist.
   
   中文:
   配置多数据源:ds1,ds1slave0,ds2,ds2slave0,ds3,ds4
   只有ds1配置分片规则,ds1,ds2配置了读写分离;ds3,ds4没有任何配置。
   
   问题:
   dws_shop_key表存在于ds3,其他ds都没有这张表。
   但执行时总是从ds2中读取dws_shop_key表,提示表不存在错误。
   
   配置多数据源报错:表不存在。
   
   application conmon file:
   spring:
     shardingsphere:
       props:
         sql-show: true
       datasource:
         names: ds1,ds1slave0,ds2,ds2slave0,ds3,ds4
         ds1:
           type: com.alibaba.druid.pool.DruidDataSource
           driver-class-name: com.mysql.cj.jdbc.Driver
         ds1slave0:
           type: com.alibaba.druid.pool.DruidDataSource
           driver-class-name: com.mysql.cj.jdbc.Driver
         ds2:
           type: com.alibaba.druid.pool.DruidDataSource
           driver-class-name: com.mysql.cj.jdbc.Driver
         ds2slave0:
           type: com.alibaba.druid.pool.DruidDataSource
           driver-class-name: com.mysql.cj.jdbc.Driver
         ds3:
           type: com.alibaba.druid.pool.DruidDataSource
           driver-class-name: com.mysql.cj.jdbc.Driver
         ds4:
           type: com.alibaba.druid.pool.DruidDataSource
           driver-class-name: com.mysql.cj.jdbc.Driver
       rules:
         sharding:
           sharding-algorithms:
             # 分片算法名称 不能使用下划线
             record-inline:
               type: CLASS_BASED
               props:
                 strategy: standard
                 algorithmClassName: com.sky.center.wb.sharding.CustomStandardShardingAlgorithm
           tables:
             bg_inside_month:
               actual-data-nodes: ds1.xxx忽略
               table-strategy:
                 standard:
                   sharding-column: b_date
                   sharding-algorithm-name: record-inline
             bg_inside_country_month:
               actual-data-nodes: ds1..xxx忽略
               table-strategy:
                 standard:
                   sharding-column: b_date
                   sharding-algorithm-name: record-inline
             bg_goods_country_month:
               actual-data-nodes: ds1.xxx忽略
               table-strategy:
                 standard:
                   sharding-column: b_date
                   sharding-algorithm-name: record-inline
             bg_goods_month:
               actual-data-nodes: ds1.xxx忽略
               table-strategy:
                 standard:
                   sharding-column: b_date
                   sharding-algorithm-name: record-inline
         readwrite-splitting:
           data-sources:
             ds1: # 逻辑数据源名字 不要乱写名字,否则读写分离不生效
               type: Static
               props:
                 write-data-source-name: ds1
                 # 从库
                 read-data-source-names: ds1slave0
                 # 负载均衡算法名称
                 load-balancer-name: round
             #            # 负载均衡算法
             ds2: # 逻辑数据源名字 不要乱写名字,否则读写分离不生效
               type: Static
               props:
                 write-data-source-name: ds2
                 # 从库
                 read-data-source-names: ds2slave0
                 # 负载均衡算法名称
                 load-balancer-name: round
           # 负载均衡算法
           load-balancers:
             round: # 负载均衡算法名称
               type: ROUND_ROBIN  #负载均衡算法类型轮询算法


-- 
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] skyjilygao closed issue #18401: Configuring multiple data sources reports an error: the table does not exist

Posted by GitBox <gi...@apache.org>.
skyjilygao closed issue #18401: Configuring multiple data sources reports an error: the table does not exist
URL: https://github.com/apache/shardingsphere/issues/18401


-- 
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] zjcnb commented on issue #18401: Configuring multiple data sources reports an error: the table does not exist

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

   @skyjilygao Hi, I think your `readwrite-splitting` configuration slave datasource are `ds1slave0` and `ds2slave0`. ShardingSphere router them when execute `SELECT` SQL. if you want to route `ds3`. You can use `SQL HINT` feature. Please refer to : https://shardingsphere.apache.org/document/current/cn/user-manual/shardingsphere-jdbc/special-api/sharding/hint/


-- 
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 #18401: Configuring multiple data sources reports an error: the table does not exist

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

   Your requirement is pretty strange. Maybe no production database cluster system need to be configured like this way, any reason for this topology?


-- 
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] skyjilygao commented on issue #18401: Configuring multiple data sources reports an error: the table does not exist

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

   Ok, but I have translated.
   English:
   Configure multiple data sources: DS1, ds1slave0, DS2, ds2slave0, DS3, DS4
   Only DS1 is configured with fragmentation rules, and DS1 and DS2 are configured with read / write separation; DS3 and DS4 are not configured.
   Question:
   dws_ shop_ The key table exists in DS3. Other DS do not have this table.
   But DWS is always read from DS2 during execution_ shop_ The key table indicates that there is no error in the table.
   Configuring multiple data sources reports an error: the table does not exist.


-- 
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] zjcnb commented on issue #18401: Configuring multiple data sources reports an error: the table does not exist

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

   @skyjilygao Please translate english for this issue.


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