zjcnb commented on issue #15086:
URL:
https://github.com/apache/shardingsphere/issues/15086#issuecomment-1022812094
```
spring:
shardingsphere:
props:
sql-show: true
datasource:
ds0:
username: root
password: 123456
url: jdbc:mysql://127.0.0.1:3306/test0
type: com.alibaba.druid.pool.DruidDataSource
driver-class-name: com.mysql.cj.jdbc.Driver
ds1:
username: root
password: 123456
url: jdbc:mysql://127.0.0.1:3306/test1
type: com.alibaba.druid.pool.DruidDataSource
driver-class-name: com.mysql.cj.jdbc.Driver
names: ds0, ds1
rules:
sharding:
sharding-algorithms:
# 分表算法
table-inline:
type: INLINE
props:
algorithm-expression: t_user$->{id % 2}
# 分库算法
database-inline:
type: INLINE
props:
algorithm-expression: ds$->{sharding_key % 2}
tables:
t_user:
actual-data-nodes: ds$->{0..1}.t_user$->{0..1}
key-generate-strategy:
column: id
key-generator-name: snowflake
# 分库策略
database-strategy:
standard:
sharding-column: sharding_key
sharding-algorithm-name: database-inline
# 分表策略
table-strategy:
standard:
sharding-column: id
sharding-algorithm-name: table-inline
key-generators:
snowflake:
type: SNOWFLAKE
props:
worker-id: 123
mode:
type: Standalone
repository:
type: File
overwrite: true
```
Please refer to the configuration.
--
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]