赞
踩
使用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: 分表策略类名
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。