shardingsphere v4.0.0以及v4.1.1版本

使用shardingsphere 进行分表操作

shardingsphere v4.0.0 会存在分页BUG  报错int类型不能转为Long类型问题  

需要升级到v4.1.1

v4.0.0的配置为

#数据配置
spring.shardingsphere.datasource.names: m1
spring.shardingsphere.datasource.m1.type: com.zaxxer.hikari.HikariDataSource
spring.shardingsphere.datasource.m1.driver‐class‐name:  com.mysql.jdbc.Driver
spring.shardingsphere.datasource.m1.jdbc-url: jdbc:mysql://IP:3306/库名?useUnicode=true&characterEncoding=UTF-8&serverTimezone=Asia/Shanghai&useSSL=false
spring.shardingsphere.datasource.m1.username: 用户名
spring.shardingsphere.datasource.m1.password: 密码

#分表依据字段设置
spring.shardingsphere.sharding.tables.表名.table-strategy.standard.sharding-column:  create_time
spring.shardingsphere.sharding.tables.表名.table-strategy.standard.precise-algorithm-class-name: 分表策略类名

升级后 配置文件中必须含有 

spring.shardingsphere.sharding.tables.cn_call_log_execute_time.actual-data-nodes

否则启动会报错

#日志表分表配置
spring.shardingsphere.datasource.names: m1
spring.shardingsphere.datasource.m1.type: com.zaxxer.hikari.HikariDataSource
spring.shardingsphere.datasource.m1.driver‐class‐name:  com.mysql.jdbc.Driver
spring.shardingsphere.datasource.m1.jdbc-url: jdbc:mysql://IP:3306/库名?useUnicode=true&characterEncoding=UTF-8&serverTimezone=Asia/Shanghai&useSSL=false
spring.shardingsphere.datasource.m1.username: 用户名
spring.shardingsphere.datasource.m1.password: 密码

#分表依据字段设置
spring.shardingsphere.sharding.tables.表名.actual-data-nodes: m1.表名_$->{1..7}
spring.shardingsphere.sharding.tables.表名.table-strategy.standard.sharding-column:  create_time
spring.shardingsphere.sharding.tables.cn_call_log.table-strategy.standard.precise-algorithm-class-name: 分表策略类名
  • 3
    点赞
  • 8
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值