当前位置:   article > 正文

shardingsphere v4.0.0以及v4.1.1版本_shardingsphere4.0.1报错getcatelog

shardingsphere4.0.1报错getcatelog

使用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: 分表策略类名
声明:本文内容由网友自发贡献,转载请注明出处:【wpsshop博客】
推荐阅读
相关标签
  

闽ICP备14008679号