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: 分表策略类名
相关推荐
l1t几秒前
在linux和windows中解决duckdb 1.6dev版本输出执行计划报错问题
linux·运维·数据库·windows·duckdb
执子手 吹散苍茫茫烟波13 分钟前
RC 隔离级别下 MySQL InnoDB 死锁典型案例
数据库·mysql
梦梦代码精28 分钟前
电商系统不是技术堆叠:LikeShop如何用分层Hold住复杂业务?
java·docker·代码规范
凯瑟琳.奥古斯特33 分钟前
K次取反最大化数组和解法(力扣1005)
开发语言·c++·算法·leetcode·职场和发展
负责的蛋挞38 分钟前
异步HttpModule的实现方式
java·服务器·前端
AC赳赳老秦1 小时前
防火墙规则批量配置实战:OpenClaw 自动生成模板、批量下发与合规性校验全解析
java·开发语言·人工智能·python·github·php·openclaw
落叶-IT1 小时前
Java异常处理深度实战教程:异常传播的失败场景分析
数据库·oracle
☆cwlulu1 小时前
调试排查工具介绍(gdb、strace、Valgrind等)
开发语言·c++·嵌入式硬件·ubuntu
Tian_Hang1 小时前
Eclipse Ditto 物模型相关代码
java·运维·服务器·ide·eureka·eclipse
C语言小火车2 小时前
C++ 快速排序(Quick Sort)深度精讲:分治思想、Lomuto 分区法及三数取中优化,面试手撕必会
c语言·开发语言·c++·面试·排序算法·快速排序