shardingJDBC 分表配置

shardingsphere 分表配置

spring.shardingsphere.datasource.names=point0   #数据库

spring.shardingsphere.datasource.point0.jdbcUrl=jdbc:mysql://XXXX:3306/point?useUnicode=true&characterEncoding=utf-8&zeroDateTimeBehavior=convertToNull
spring.shardingsphere.datasource.point0.username=XX
spring.shardingsphere.datasource.point0.password=XX
spring.shardingsphere.datasource.point0.driver-class-name=com.mysql.jdbc.Driver

spring.shardingsphere.datasource.point0.type=com.zaxxer.hikari.HikariDataSource
spring.shardingsphere.datasource.point0.minimum-idle=150
spring.shardingsphere.datasource.point0.maximum-pool-size=200
spring.shardingsphere.datasource.point0.auto-commit=true
spring.shardingsphere.datasource.point0.idle-timeout=30000
spring.shardingsphere.datasource.point0.pool-name=ShareHikariCP0
spring.shardingsphere.datasource.point0.max-lifetime=1800000
spring.shardingsphere.datasource.point0.connection-timeout=30000
spring.shardingsphere.datasource.point0.connection-test-query=SELECT 1

spring.shardingsphere.sharding.default-data-source-name=point0

#账户表 分表配置
spring.shardingsphere.sharding.tables.account.actual-data-nodes=point0.account_$->{0..31}
spring.shardingsphere.sharding.tables.account.table-strategy.inline.sharding-column=user_id
spring.shardingsphere.sharding.tables.account.table-strategy.inline.algorithm-expression=account_$->{user_id % 32}
spring.shardingsphere.sharding.tables.account.key-generator.column=id
spring.shardingsphere.sharding.tables.account.key-generator.type=SNOWFLAKE
spring.shardingsphere.sharding.tables.account.key-generator.props.worker.id=${random.int[0,1024]}
spring.shardingsphere.sharding.tables.account.key-generator.props.max.tolerate.time.difference.milliseconds=10
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值