shardingjdbc每月分表_shardingjdbc分库分表测试
springboot + mybatis-plus + mysql + sharding-jdbc
部分配置:
pom.xml
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
4.0.0
org.springframework.boot
spring-boot-starter-parent
2.2.0.M3
com.shardingjdbc
shardingjdbc
0.0.1-SNAPSHOT
shardingjdbc
shardingjdbc project for Spring Boot
1.8
org.springframework.boot
spring-boot-starter-web
org.springframework.boot
spring-boot-starter-tomcat
org.springframework.boot
spring-boot-starter-undertow
commons-dbcp
commons-dbcp
1.4
com.baomidou
mybatis-plus
2.1.9
com.baomidou
mybatisplus-spring-boot-starter
1.0.5
mysql
mysql-connector-java
5.1.47
io.shardingsphere
sharding-jdbc-spring-boot-starter
3.0.0.M4
org.springframework.boot
spring-boot-maven-plugin
application.yml
server:
# 端口
port: 1818
undertow:
# 编码
uri-encoding: UTF-8
spring:
main:
allow-bean-definition-overriding: true
resources:
# 静态资源文件夹
static-locations: classpath:/
# 序列化
jackson:
date-format: yyyy-MM-dd HH:mm:ss
time-zone: GMT+8
serialization:
#忽略无法转换的对象
fail_on_empty_beans: false
deserialization:
#允许对象忽略json中不存在的属性
fail_on_unknown_properties: false
#设置空如何序列化
defaultPropertyInclusion: ALWAYS
parser:
#允许出现特殊字符和转义符
allow_unquoted_control_chars: true
#允许出现单引号
allow_single_quotes: true
# 分库
sharding:
jdbc:
datasource:
names: shard1,shard2
shard1:
type: org.apache.commons.dbcp.BasicDataSource
driver-class-name: com.mysql.jdbc.Driver
url: jdbc:mysql://localhost:3306/shard1
username: root
password: root
shard2:
type: org.apache.commons.dbcp.BasicDataSource
driver-class-name: com.mysql.jdbc.Driver
url: jdbc:mysql://localhost:3306/shard2
username: root
password: root
config:
sharding:
# 默认数据源(未设置分表策略的表将默认用此数据源)
default-datasource-name: shard1
# 默认分库策略
default-database-strategy:
standard:
sharding-column: id
precise-algorithm-class-name: com.shardingjdbc.config.sharding.DataBasePreciseRule
# 分表策略
tables:
# 分库分表
table_one:
actual-data-nodes: shard$->{1..2}.table_one_$->{1..2}
table-strategy:
standard:
sharding-column: id
precise-algorithm-class-name: com.shardingjdbc.config.sharding.DataTablePreciseRule
# mybatis-plus 的分页插件
pagehelper:
helper-dialect: mysql
params: count=countSql
reasonable: false
support-methods-arguments: true
# mybatis-plus
mybatis-plus:
mapper-locations: /mapper/**/**.xml
typeAliasesPackage: com.shardingjdbc.domain
global-config:
id-type: 3
field-strategy: 2
db-column-underline: true
refresh-mapper: true
configuration:
map-underscore-to-camel-case: true
cache-enabled: false
call-setters-on-nulls: true
其他代码详见git仓库:
shardingjdbc每月分表_shardingjdbc分库分表测试相关推荐
- shardingjdbc全局表_Sharding-JDBC 分库分表概述
分库分表是什么 小明是一家初创电商平台的开发人员,他负责卖家模块的功能开发,其中涉及了店铺.商品的相关业务,设计如下数据库: 通过以下SQL能够获取到商品相关的店铺信息.地理区域信息: SELECT ...
- shardingjdbc全局表_Sharding-JDBC动态分表实现
Sharding-JDBC动态水平分表实现 背景: 在项目中遇到了按照日期动态水平分表的需求,系统属于监控系统,每10分钟保存一次监控数据,并且每次要采集200个节点上的数据,即每次采集数据(间隔10 ...
- 老大批评我不要为了“分库分表”而“分库分表”
点击上方"方志朋",选择"设为星标" 回复"666"获取新整理的面试文章 来自:rrd.me/gEJnq 当数据库的数据量过大,大到一定的程 ...
- 不要为了“分库分表”而“分库分表”
不要为了"分库分表"而"分库分表" https://www.toutiao.com/i6950110063927394830/?tt_from=weixin&a ...
- java hash 分库分表_分库分表方案
摘自:Java技术栈 一.数据库瓶颈 不管是IO瓶颈,还是CPU瓶颈,最终都会导致数据库的活跃连接数增加,进而逼近甚至达到数据库可承载活跃连接数的阈值. 在业务Service来看就是,可用数据库连接少 ...
- 数据量大了一定要分表,分库分表 Sharding-JDBC 入门与项目实战
点击上方"方志朋",选择"设为星标" 回复"666"获取新整理的面试文章 来源:juejin.im/post/684490418236581 ...
- 中间省略_SpringBoot2 高级案例(03): 整合sharding-jdbc中间件,实现数据分库分表
一.水平分割 1.水平分库 1).概念: 以字段为依据,按照一定策略,将一个库中的数据拆分到多个库中. 2).结果 每个库的结构都一样:数据都不一样: 所有库的并集是全量数据: 2.水平分表 1).概 ...
- Sharding-Jdbc实现读写分离、分库分表,妙!
点击关注公众号,实用技术文章及时了解 1.概览 ShardingSphere-Jdbc定位为轻量级Java框架,在Java的Jdbc层提供的额外服务.它使用客户端直连数据库,以jar包形式提供服务,可 ...
- 数据量大了一定要分表,分库分表Sharding-JDBC入门与项目实战
作者:六点半起床 juejin.im/post/6844904182365814797 最近项目中不少表的数据量越来越大,并且导致了一些数据库的性能问题.因此想借助一些分库分表的中间件,实现自动化分库 ...
最新文章
- VC 系统托盘编程,含有气泡提示
- 10 个冷门但又非常实用的 Docker 使用技巧
- M码小黄衫买家秀=w=
- 同步通信和异步通信的区别
- C#Semaphore信号量用法
- 微型计算机中的奔四指的是,2015云南省计算机等级考试二级理论考试试题及答案...
- 美国副教授现身说法:如何改变“只收藏不阅读”的习惯
- C语言中全局变量、局部变量、静态全局变量、静态局部变量的区别 (转)
- linux模拟器使用教程,Ubuntu多机种游戏模拟器Mednafen教程
- 漏洞扫描技术:对Web应用程序进行漏洞扫描
- Thingsboard 本地编译 com.google.protobuf:protoc:exe:osx-x86_64:3.11.4 无法下载
- win7网络发现启用后找不到网络计算机,网络发现启用不了|无法启用网络发现的解决方法...
- 手机QQ邮箱可以发html邮件么,如何使用手机qq邮箱发送邮件
- MCU 8080规格LCD屏显示优化——RGB666
- C++ 输出cout
- 程序员版「成语新解」,万万没想到你们竟是这样的……
- Windows 平台下局域网劫持测试工具 – EvilFoca
- 手持PDA和手机有什么区别?
- html基本样式及表格
- (教程) 个人微信公众号做查券机器人怎么关联优惠券小程序?
热门文章
- 数据库索引是什么?新华字典来帮你!
- mysql webservice接口_WebService接口在PHP中的使用
- cannot import name ‘compare_ssim‘
- Expected more than 1 value per channel when training, got input size torch.Size
- MNN windows
- torch 判断相等
- tensorflow r1.5 版本差异调研
- python计算相关系数
- ubuntu 查看串口,设置串口权限
- 五、唱歌不如跳舞(下)