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/07 03:49:17 UTC
[GitHub] [shardingsphere] strongyc opened a new issue, #20845: Master-slave problem
strongyc opened a new issue, #20845:
URL: https://github.com/apache/shardingsphere/issues/20845
## Bug Report
Using version 5.1.2, after configuring read-write separation and data fragmentation, the fragmented table cannot be read from the slave library, and other tables can read from the slave library normally. Why
**For English only**, other languages will not accept.
Before report a bug, make sure you have:
- Searched open and closed [GitHub issues](https://github.com/apache/shardingsphere/issues).
- Read documentation: [ShardingSphere Doc](https://shardingsphere.apache.org/document/current/en/overview).
Please pay attention on issues you submitted, because we maybe need more details.
If no response anymore and we cannot reproduce it on current information, we will **close it**.
Please answer these questions before submitting your issue. Thanks!
### Which version of ShardingSphere did you use?
5.1.2
### Which project did you use? ShardingSphere-JDBC or ShardingSphere-Proxy?
ShardingSphere-JDBC
spring:
shardingsphere:
mode:
type: Memory
datasource:
names: db1,db2
db1:
driver-class-name: com.mysql.cj.jdbc.Driver
jdbc-url: jdbc:mysql://192.168.37.130:3306/student?useUnicode=true&characterEncoding=utf-8&useSSL=false&serverTimezone=Asia/Shanghai
username: root
password:
type: com.zaxxer.hikari.HikariDataSource
db2:
driver-class-name: com.mysql.cj.jdbc.Driver
jdbc-url: jdbc:mysql://192.168.37.132:3306/student?useUnicode=true&characterEncoding=utf-8&useSSL=false&serverTimezone=Asia/Shanghai
username: root
password:
type: com.zaxxer.hikari.HikariDataSource
rules:
sharding:
tables:
document:
actual-data-nodes: db1.document_$->{2013..2022}
table-strategy:
standard:
sharding-algorithm-name: document-inline # 分片算法名称
sharding-column: document_year
key-generate-strategy:
column: id
key-generator-name: timestamp #主键生成算法#主键生成算法
sharding-algorithms:
document-inline:
type: INLINE
props:
algorithm-expression: document_$->{document_year}
key-generators:
timestamp:
type: SNOWFLAKE
readwrite-splitting:
data-sources:
read_write_db:
type: Static
props:
write-data-source-name: db1
read-data-source-names: db2
load-balancer-name: round_robin
load-balancers:
round_robin:
type: ROUND_ROBIN
props:
sql-show: true
### Expected behavior
### Actual behavior
select use db2
### Reason analyze (If you can)
### Steps to reproduce the behavior, such as: SQL to execute, sharding rule configuration, when exception occur etc.
### Example codes for reproduce this issue (such as a github link).
--
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] strongyc commented on issue #20845: Master-slave problem
Posted by GitBox <gi...@apache.org>.
strongyc commented on issue #20845:
URL: https://github.com/apache/shardingsphere/issues/20845#issuecomment-1238959384
results: 2022-09-07 13:52:50.801 INFO 25968 --- [nio-8080-exec-1] ShardingSphere-SQL : Actual SQL: db1 ::: SELECT id,document_name,document_detail,document_year FROM document_2013 UNION ALL SELECT id,document_name,document_detail,document_year FROM document_2014 UNION ALL SELECT id,document_name,document_detail,document_year FROM document_2015 UNION ALL SELECT id,document_name,document_detail,document_year FROM document_2016 UNION ALL SELECT id,document_name,document_detail,document_year FROM document_2017 UNION ALL SELECT id,document_name,document_detail,document_year FROM document_2018 UNION ALL SELECT id,document_name,document_detail,document_year FROM document_2019 UNION ALL SELECT id,document_name,document_detail,document_year FROM document_2020 UNION ALL SELECT id,document_name,document_detail,document_year FROM document_2021 UNION ALL SELECT id,document_name,document_detail,document_year FROM document_2022
--
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] strongyc commented on issue #20845: Master-slave problem
Posted by GitBox <gi...@apache.org>.
strongyc commented on issue #20845:
URL: https://github.com/apache/shardingsphere/issues/20845#issuecomment-1239005799
> Hi @strongyc, thank you for your feedback. Can you modify the title for searching friendly? Besides, can you format your issue with markdown?
### 1.problem
Using version 5.1.2, after configuring read-write separation and data fragmentation, the fragmented table cannot be read from the slave library, and other tables can read from the slave library normally. Why
## 2. Which version of ShardingSphere did you use?
5.1.2
### 3. Which project did you use? ShardingSphere-JDBC or ShardingSphere-Proxy?
ShardingSphere-JDBC
## 4.settings
springboot2.7.3+MybaitsPlus3.5.2+shardingShere5.1.2
```
spring:
shardingsphere:
mode:
type: Memory
datasource:
names: db1,db2
db1:
driver-class-name: com.mysql.cj.jdbc.Driver
jdbc-url: jdbc:mysql://192.168.37.130:3306/student?useUnicode=true&characterEncoding=utf-8&useSSL=false&serverTimezone=Asia/Shanghai
username: root
password:
type: com.zaxxer.hikari.HikariDataSource
db2:
driver-class-name: com.mysql.cj.jdbc.Driver
jdbc-url: jdbc:mysql://192.168.37.132:3306/student?useUnicode=true&characterEncoding=utf-8&useSSL=false&serverTimezone=Asia/Shanghai
username: root
password:
type: com.zaxxer.hikari.HikariDataSource
rules:
sharding:
tables:
document:
actual-data-nodes: db1.document_$->{2013..2022}
table-strategy:
standard:
sharding-algorithm-name: document-inline # 分片算法名称
sharding-column: document_year
key-generate-strategy:
column: id
key-generator-name: timestamp #主键生成算法#主键生成算法
sharding-algorithms:
document-inline:
type: INLINE
props:
algorithm-expression: document_$->{document_year}
key-generators:
timestamp:
type: SNOWFLAKE
readwrite-splitting:
data-sources:
read_write_db:
type: Static
props:
write-data-source-name: db1
read-data-source-names: db2
load-balancer-name: round_robin
load-balancers:
round_robin:
type: ROUND_ROBIN
props:
sql-show: true
```
### 5.results of enforcement
2022-09-07 13:52:50.801 INFO 25968 --- [nio-8080-exec-1] ShardingSphere-SQL : Actual SQL: db1 ::: SELECT id,document_name,document_detail,document_year FROM document_2013 UNION ALL SELECT id,document_name,document_detail,document_year FROM document_2014 UNION ALL SELECT id,document_name,document_detail,document_year FROM document_2015 UNION ALL SELECT id,document_name,document_detail,document_year FROM document_2016 UNION ALL SELECT id,document_name,document_detail,document_year FROM document_2017 UNION ALL SELECT id,document_name,document_detail,document_year FROM document_2018 UNION ALL SELECT id,document_name,document_detail,document_year FROM document_2019 UNION ALL SELECT id,document_name,document_detail,document_year FROM document_2020 UNION ALL SELECT id,document_name,document_detail,document_year FROM document_2021 UNION ALL SELECT id,document_name,document_detail,document_year FROM document_2022
## 6.why?
According to the configuration, db1 is the master library and db2 is the slave Library,why is db1
--
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] strongyc commented on issue #20845: Master-slave problem
Posted by GitBox <gi...@apache.org>.
strongyc commented on issue #20845:
URL: https://github.com/apache/shardingsphere/issues/20845#issuecomment-1238999322
### 1.problem
Using version 5.1.2, after configuring read-write separation and data fragmentation, the fragmented table cannot be read from the slave library, and other tables can read from the slave library normally. Why
## 2. Which version of ShardingSphere did you use?
5.1.2
### 3. Which project did you use? ShardingSphere-JDBC or ShardingSphere-Proxy?
ShardingSphere-JDBC
## 4.settings
springboot2.7.3+MybaitsPlus3.5.2+shardingShere5.1.2
```
spring:
shardingsphere:
mode:
type: Memory
datasource:
names: db1,db2
db1:
driver-class-name: com.mysql.cj.jdbc.Driver
jdbc-url: jdbc:mysql://192.168.37.130:3306/student?useUnicode=true&characterEncoding=utf-8&useSSL=false&serverTimezone=Asia/Shanghai
username: root
password:
type: com.zaxxer.hikari.HikariDataSource
db2:
driver-class-name: com.mysql.cj.jdbc.Driver
jdbc-url: jdbc:mysql://192.168.37.132:3306/student?useUnicode=true&characterEncoding=utf-8&useSSL=false&serverTimezone=Asia/Shanghai
username: root
password:
type: com.zaxxer.hikari.HikariDataSource
rules:
sharding:
tables:
document:
actual-data-nodes: db1.document_$->{2013..2022}
table-strategy:
standard:
sharding-algorithm-name: document-inline # 分片算法名称
sharding-column: document_year
key-generate-strategy:
column: id
key-generator-name: timestamp #主键生成算法#主键生成算法
sharding-algorithms:
document-inline:
type: INLINE
props:
algorithm-expression: document_$->{document_year}
key-generators:
timestamp:
type: SNOWFLAKE
readwrite-splitting:
data-sources:
read_write_db:
type: Static
props:
write-data-source-name: db1
read-data-source-names: db2
load-balancer-name: round_robin
load-balancers:
round_robin:
type: ROUND_ROBIN
props:
sql-show: true
```
### 5.results of enforcement
2022-09-07 13:52:50.801 INFO 25968 --- [nio-8080-exec-1] ShardingSphere-SQL : Actual SQL: db1 ::: SELECT id,document_name,document_detail,document_year FROM document_2013 UNION ALL SELECT id,document_name,document_detail,document_year FROM document_2014 UNION ALL SELECT id,document_name,document_detail,document_year FROM document_2015 UNION ALL SELECT id,document_name,document_detail,document_year FROM document_2016 UNION ALL SELECT id,document_name,document_detail,document_year FROM document_2017 UNION ALL SELECT id,document_name,document_detail,document_year FROM document_2018 UNION ALL SELECT id,document_name,document_detail,document_year FROM document_2019 UNION ALL SELECT id,document_name,document_detail,document_year FROM document_2020 UNION ALL SELECT id,document_name,document_detail,document_year FROM document_2021 UNION ALL SELECT id,document_name,document_detail,document_year FROM document_2022
## 6.why?
According to the configuration, db1 is the master library and db2 is the slave Library,why is db1
--
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] strongyc commented on issue #20845: Master-slave problem
Posted by GitBox <gi...@apache.org>.
strongyc commented on issue #20845:
URL: https://github.com/apache/shardingsphere/issues/20845#issuecomment-1238960960
According to the configuration, db1 is the master library and db2 is the slave Library,why is db1
--
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] strongyc commented on issue #20845: Master-slave problem
Posted by GitBox <gi...@apache.org>.
strongyc commented on issue #20845:
URL: https://github.com/apache/shardingsphere/issues/20845#issuecomment-1239372184
![image](https://user-images.githubusercontent.com/51156342/188886698-a90bb47c-9f2a-4776-9014-094c9e7a9ce2.png)
The library without fragment key is correct
--
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] strongyc commented on issue #20845: Master-slave problem
Posted by GitBox <gi...@apache.org>.
strongyc commented on issue #20845:
URL: https://github.com/apache/shardingsphere/issues/20845#issuecomment-1241464126
> Hi @strongyc, thank you for your feedback. Can you modify the title for searching friendly? Besides, can you format your issue with markdown?
thinks,resolved
--
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] strongduanmu commented on issue #20845: Master-slave problem
Posted by GitBox <gi...@apache.org>.
strongduanmu commented on issue #20845:
URL: https://github.com/apache/shardingsphere/issues/20845#issuecomment-1238974997
Hi @strongyc, thank you for your feedback. Can you modify the title for searching friendly? Besides, can you format your issue with markdown?
--
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] strongyc closed issue #20845: Master-slave problem
Posted by GitBox <gi...@apache.org>.
strongyc closed issue #20845: Master-slave problem
URL: https://github.com/apache/shardingsphere/issues/20845
--
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