wpd-static commented on issue #28578:
URL:
https://github.com/apache/shardingsphere/issues/28578#issuecomment-1733680765
yaml file:
spring:
datasource:
type: com.zaxxer.hikari.HikariDataSource
driver-class-name: com.mysql.cj.jdbc.Driver
url:
jdbc:mysql://localhost:3306/stu?characterEncoding=utf-8&userSSL=false&serverTimezone=Asia/Shanghai
username: root
password: root
shardingsphere:
# 数据源配置
datasource:
# 数据源名称,多数据源以逗号分隔 ,放在第一个的数据源为未配置分片规则表的默认数据源
names: db0
db0:
# 数据库连接池类名称
type: com.zaxxer.hikari.HikariDataSource
# 数据库驱动类名
driver-class-name: com.mysql.cj.jdbc.Driver
jdbc-url:
jdbc:mysql://localhost:3306/stu?useUnicode=true&characterEncoding=utf-8&useSSL=false&serverTimezone=Asia/Shanghai&allowPublicKeyRetrieval=true
username: root
password: root
# 规则配置
rules:
sharding:
# 设置默认数据源
default-data-source-name: db0
tables:
ob_string:
actual-data-nodes: db0.ob_string_$->{0..15}
table-strategy:
standard:
sharding-column: ref_id
sharding-algorithm-name: ob-string-inline
# 分片算法配置
sharding-algorithms:
ob-string-inline:
type: INLINE
props:
algorithm-expression: ob_string_$->{ref_id % 16}
# 分布式序列算法配置
# 属性配置
props:
# 展示修改以后的sql语句
sql-show: true
--
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]