一主两从,爆红是正常的,不知为啥
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
相关推荐
Flittly4 小时前
【AgentScope Java新手村系列】(16)从RAG到多路检索小兔崽子去哪了4 小时前
Java 生成二维码解决方案人活一口气9 小时前
从JVM调优到MCP协议:Java全栈技术体系深度总结与企业级架构实践NE_STOP10 小时前
Vibe Coding -- 完整项目案例实操荣码10 小时前
GraphRAG:普通RAG只能回答"点"的问题,我踩了4个坑才搞懂SimonKing10 小时前
Google第三方授权登录明月光81811 小时前
从一行 @Builder 说起:重新拾起 Java 的 Lombok、注解与 Builder 模式考虑考虑20 小时前
Mybatis实现批量插入咖啡八杯21 小时前
GoF设计模式——中介者模式青石路1 天前
记一次多JDK版本问题的排查,一坑套一坑,差点没爬上来