nb333999 opened a new issue, #28318:
URL: https://github.com/apache/shardingsphere/issues/28318
This is my configuration file (read-write separation, multi-master and
multi-slave):
databaseName: na2069
dataSources:
master_0:
url:
jdbc:mysql://172.30.10.26:3306/na2060?characterEncoding=utf-8&serverTimezone=Asia/Shanghai&useSSL=false&allowMultiQueries=true
username: root
password: 123456
connectionTimeoutMilliseconds: 30000
idleTimeoutMilliseconds: 60000
maxLifetimeMilliseconds: 1800000
maxPoolSize: 50
minPoolSize: 1
slave00:
url:
jdbc:mysql://172.30.10.26:3306/na2060?characterEncoding=utf-8&serverTimezone=Asia/Shanghai&useSSL=false&allowMultiQueries=true
username: root
password: 123456
connectionTimeoutMilliseconds: 30000
idleTimeoutMilliseconds: 60000
maxLifetimeMilliseconds: 1800000
maxPoolSize: 50
minPoolSize: 1
slave01:
url:
jdbc:mysql://172.30.10.26:3306/na2060?characterEncoding=utf-8&serverTimezone=Asia/Shanghai&useSSL=false&allowMultiQueries=true
username: root
password: 123456
connectionTimeoutMilliseconds: 30000
idleTimeoutMilliseconds: 60000
maxLifetimeMilliseconds: 1800000
maxPoolSize: 50
minPoolSize: 1
master_1:
url:
jdbc:mysql://172.30.10.26:3306/na2060?characterEncoding=utf-8&serverTimezone=Asia/Shanghai&useSSL=false&allowMultiQueries=true
username: root
password: 123456
connectionTimeoutMilliseconds: 30000
idleTimeoutMilliseconds: 60000
maxLifetimeMilliseconds: 1800000
maxPoolSize: 50
minPoolSize: 1
slave10:
url:
jdbc:mysql://172.30.10.26:3306/na2060?characterEncoding=utf-8&serverTimezone=Asia/Shanghai&useSSL=false&allowMultiQueries=true
username: root
password: 123456
connectionTimeoutMilliseconds: 30000
idleTimeoutMilliseconds: 60000
maxLifetimeMilliseconds: 1800000
maxPoolSize: 50
minPoolSize: 1
slave11:
url:
jdbc:mysql://172.30.10.26:3306/na2060?characterEncoding=utf-8&serverTimezone=Asia/Shanghai&useSSL=false&allowMultiQueries=true
username: root
password: 123456
connectionTimeoutMilliseconds: 30000
idleTimeoutMilliseconds: 60000
maxLifetimeMilliseconds: 1800000
maxPoolSize: 50
minPoolSize: 1
rules:
- !SINGLE
tables:
- "*.*"
- !BROADCAST
tables:
- merchant
- !SHARDING
tables:
admin:
actualDataNodes: rw_ds_${0..1}.admin
bindingTables:
- admin
defaultDatabaseStrategy:
standard:
shardingColumn: mid
shardingAlgorithmName: database_inline
defaultTableStrategy:
none:
shardingAlgorithms:
database_inline:
type: INLINE
props:
algorithm-expression: rw_ds_${mid % 2}
allow-range-query-with-inline-sharding: true
defaultShardingColumn: mid
- !READWRITE_SPLITTING
dataSources:
rw_ds_0:
writeDataSourceName: master_0
readDataSourceNames:
- slave00
- slave01
transactionalReadQueryStrategy: PRIMARY
loadBalancerName: round_robin
rw_ds_1:
writeDataSourceName: master_1
readDataSourceNames:
- slave10
- slave11
transactionalReadQueryStrategy: PRIMARY
loadBalancerName: round_robin
loadBalancers:
round_robin:
type: ROUND_ROBIN
Table admin can read and write normally, and the sub-database is also normal.
However, when reading and writing the broadcast table merchant, it will be
executed in all libraries such as master_0, slave00, master_1, slave11, etc.


But the effect I want for the broadcast table is:
When reading, read from the read library that separates reading and
writing.
When writing, write to the write library that reads and writes separately.
For example
when reading:
SELECT * FROM merchant WHERE `mid` = 132 LIMIT 0, 1000
This SQL should poll read from slave00 and slave01
when modifying:
UPDATE merchant SET quota = quota - 10 WHERE `mid` = 132
This SQL should be written to master_0
How should I configure it?
--
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]