一主两从,爆红是正常的,不知为啥
spring:
shardingsphere:
datasource:
names: ds_master,ds_s1,ds_s2
ds_master:
type: com.zaxxer.hikari.HikariDataSource
driverClassName: com.mysql.jdbc.Driver
jdbcUrl: jdbc:mysql://192.168.135.100:3306/gmall_product?serverTimezone=UTC
username: root
password: 123456
ds_s1:
type: com.zaxxer.hikari.HikariDataSource
driverClassName: com.mysql.jdbc.Driver
jdbcUrl: jdbc:mysql://192.168.135.100:3307/gmall_product?serverTimezone=UTC
username: root
password: 123456
ds_s2:
type: com.zaxxer.hikari.HikariDataSource
driverClassName: com.mysql.jdbc.Driver
jdbcUrl: jdbc:mysql://192.168.135.100:3308/gmall_product?serverTimezone=UTC
username: root
password: 123456
rules:
readwrite-splitting:
data-sources:
product-rw-ds:
type: Static
props:
write-data-source-name: ds_master
read-data-source-names: ds_s1,ds_s2
load-balancer-name: product_lb_alg #负载均衡算法名称
# static-strategy: #读写分离策略
load-balancers:
product_lb_alg:
type: ROUND_ROBIN
sharding-jdbc读写分离配置
m0_719084112025-08-17 18:16
相关推荐
FastBean6 分钟前
Jackson View Extension Spring Boot StarterSeven971 小时前
剑指offer-79、最⻓不含重复字符的⼦字符串皮皮林55111 小时前
Java性能调优黑科技!1行代码实现毫秒级耗时追踪,效率飙升300%!冰_河11 小时前
QPS从300到3100:我靠一行代码让接口性能暴涨10倍,系统性能原地起飞!!桦说编程14 小时前
从 ForkJoinPool 的 Compensate 看并发框架的线程补偿思想躺平大鹅15 小时前
Java面向对象入门(类与对象,新手秒懂)初次攀爬者16 小时前
RocketMQ在Spring Boot上的基础使用花花无缺16 小时前
搞懂@Autowired 与@ResuorceDerek_Smart18 小时前
从一次 OOM 事故说起:打造生产级的 JVM 健康检查组件