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 2020/11/28 05:08:18 UTC
[GitHub] [shardingsphere] chen11181989 opened a new issue #8394: YML方式配置没走分片策略是什么原因呢
chen11181989 opened a new issue #8394:
URL: https://github.com/apache/shardingsphere/issues/8394
# 数据源配置
spring:
shardingsphere:
datasource:
common:
type: com.alibaba.druid.pool.DruidDataSource
driver-class-name: com.mysql.jdbc.Driver
# 数据库名称,可自定义,可以为多个,以逗号隔开,每个在这里定义的库,都要在下面定义连接属性
names: ds0,ds1
#年份为2019年的库
ds0:
# 采用的数据库连接池,druid
#type: com.alibaba.druid.pool.DruidDataSource
#driver-class-name: com.mysql.jdbc.Driver
url: jdbc:mysql://localhost:3306/ds0?useUnicode=true&characterEncoding=UTF-8&useSSL=false&serverTimezone=Asia/Shanghai
username: root
password: 6yhn&UJM
#年份为2020年的库
ds1:
#type: com.alibaba.druid.pool.DruidDataSource
#driver-class-name: com.mysql.jdbc.Driver
url: jdbc:mysql://localhost:3306/ds1?useUnicode=true&characterEncoding=UTF-8&useSSL=false&serverTimezone=Asia/Shanghai
username: root
password: 6yhn&UJM
rules:
tables:
# 配置 t_order 表规则
sc_collection:
actualDataNodes: ds${0..1}.sc_collection_${0..1}
# 配置分库策略 port: 6379
databaseStrategy:
standard:
shardingColumn: user_id
shardingAlgorithmName: database_inline
# 配置分表策略 config: classpath:redisson.yml
tableStrategy:
standard:
shardingColumn: user_id
shardingAlgorithmName: table_inline
keyGenerateStrategy:
column: user_id
keyGeneratorName: snowflake
shardingAlgorithms:
database_inline:
type: INLINE
props:
algorithm-expression: ds${user_id % 2}
table_inline:
type: INLINE
props:
algorithm-expression: sc_collection_${user_id % 2}
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [shardingsphere] chen11181989 closed issue #8394: YML方式配置没走分片策略是什么原因呢
Posted by GitBox <gi...@apache.org>.
chen11181989 closed issue #8394:
URL: https://github.com/apache/shardingsphere/issues/8394
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org