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: 分表策略类名
相关推荐
wangmengxxw6 分钟前
Spring-常用注解
java·数据库·spring·注解
三小尛10 分钟前
C++赋值运算符重载
开发语言·c++
籍籍川草13 分钟前
JVM指针压缩的那些事
java·开发语言·jvm
m0_7472660918 分钟前
contentprovider实验+SQLite数据库的实现
数据库·sqlite
小徐不徐说21 分钟前
C++ 模板与 STL 基础入门:从泛型编程到实战工具集
开发语言·数据结构·c++·qt·面试
艾莉丝努力练剑22 分钟前
【C/C++】类和对象(上):(一)类和结构体,命名规范——两大规范,新的作用域——类域
java·c语言·开发语言·c++·学习·算法
myNameGL35 分钟前
下载一个JeecgBoot-master项目 导入idea需要什么操作启动项目
java·ide·intellij-idea
froginwe1138 分钟前
WebPages PHP:深入解析PHP在网页开发中的应用
开发语言
TDengine (老段)1 小时前
TDengine 中 TDgp 中添加机器学习模型
大数据·数据库·算法·机器学习·数据分析·时序数据库·tdengine
Emotion亦楠1 小时前
Java 学习笔记:常用类、String 与日期时间处理
java·笔记·学习