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: 分表策略类名
相关推荐
_龙小鱼_6 分钟前
Kotlin扩展简化Android动画开发
android·开发语言·kotlin
_龙小鱼_7 分钟前
Kotlin 作用域函数(let、run、with、apply、also)对比
java·前端·kotlin
小伍_Five12 分钟前
spark数据处理练习题详解【上】
java·开发语言·spark·scala
Mcband13 分钟前
EasyExcel动态表头
java·windows
元亓亓亓20 分钟前
MySQL--day2--基本的select语句
数据库·mysql
曼岛_21 分钟前
[Java实战]Spring Boot整合RabbitMQ:实现异步通信与消息确认机制(二十七)
java·spring boot·java-rabbitmq
mascon22 分钟前
C#自定义扩展方法 及 EventHandler<TEventArgs> 委托
开发语言·c#
辛普森Mmmm28 分钟前
Mysql数据库详解
数据库·mysql
冬瓜的编程笔记33 分钟前
【MySQL成神之路】MySQL常见命令汇总
数据库·mysql
FBI HackerHarry浩39 分钟前
Linux云计算训练营笔记day10(MySQL数据库)
linux·运维·数据库·笔记·mysql