spring:
shardingsphere:
datasource:
names: ds0,ds1
# 主库 1,master 数据库
ds0:
xxxxxx
# 从库 1,slave 数据库
ds1:
xxxxx
props:
sql-show: true
sql-simple: false
# 是否在启动时检查分表元数据一致性
check-table-metadata-enabled: true
check-duplicate-table-enabled: false
sql-comment-parse-enabled: false
sql-federation-enabled: false
rules:
# 分片
sharding:
tables:
xxxxxx:
actual-data-nodes: ds$->{0..1}.xxxxx$->{0..7}
table-strategy:
standard:
sharding-column: uid
sharding-algorithm-name: xxxxAl
default-sharding-column: uid
binding-tables:
- xxxxxx
broadcast-tables:
default-database-strategy:
none:
default-table-strategy:
none:
sharding-algorithms:
xxxxAl:
type: INLINE
props:
algorithm-expression: xxxxxx_xxxx
### 读写分离
readwrite-splitting:
data-sources:
readwrite_ds:
type: Static
load-balancer-name: round_robin
props:
write-data-source-name: ds0
read-data-source-names: ds1
load-balancers:
round_robin:
type: ROUND_ROBIN
这是一个专为移动设备优化的页面(即为了让你能够在 Google 搜索结果里秒开这个页面),如果你希望参与 V2EX 社区的讨论,你可以继续到 V2EX 上打开本讨论主题的完整版本。
V2EX 是创意工作者们的社区,是一个分享自己正在做的有趣事物、交流想法,可以遇见新朋友甚至新机会的地方。
V2EX is a community of developers, designers and creative people.