一主两从,爆红是正常的,不知为啥
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
相关推荐
YA3333 小时前
java设计模式二、工厂金色天际线-3 小时前
Nginx 优化与防盗链配置指南我爱挣钱我也要早睡!4 小时前
Java 复习笔记AD钙奶-lalala6 小时前
Mac OS上搭建 http server皮皮林5519 小时前
SpringBoot 全局/局部双模式 Gzip 压缩实战:14MB GeoJSON 秒变 3MBweixin_4569042710 小时前
Spring Boot 用户管理系统趁你还年轻_10 小时前
异步编程CompletionServiceDKPT10 小时前
Java内存区域与内存溢出sibylyue10 小时前
Guava中常用的工具类奔跑吧邓邓子10 小时前
【Java实战㉞】从0到1:Spring Boot Web开发与接口设计实战