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: 分表策略类名
相关推荐
2501_916766544 分钟前
解决idea依赖导入不成功的问题
java·intellij-idea
头发还在的女程序员7 分钟前
基于JAVA语言的短剧小程序-抖音短剧小程序
java·开发语言·小程序
JHC00000011 分钟前
Python PDF 相关操作
开发语言·python·pdf
vir0216 分钟前
P12155 [蓝桥杯 2025 省 Java B] 消失的蓝宝
java·职场和发展·蓝桥杯
q***99433 分钟前
Redis的Spring配置
数据库·redis·spring
温轻舟40 分钟前
Python自动办公工具01-Excel文件编辑器
开发语言·python·编辑器·excel·温轻舟
S***y3961 小时前
MySQL视频
数据库·mysql
周杰伦fans1 小时前
[特殊字符] 代理模式超详细讲解 ——.NET
数据库·c#·代理模式
爱笑的眼睛111 小时前
PyTorch Lightning:重新定义深度学习工程实践
java·人工智能·python·ai
Kevinyu_2 小时前
责任链模式
java·hadoop·责任链模式