一主两从,爆红是正常的,不知为啥
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
相关推荐
比特森林探险记1 天前
【无标题】椰猫子1 天前
Javaweb(Filter、Listener、AJAX、JSON)朝新_1 天前
【Spring AI 】核心知识体系梳理:从入门到实战一 乐1 天前
旅游|基于springboot + vue旅游信息推荐系统(源码+数据库+文档)我命由我123451 天前
Android 开发中,关于 Gradle 的 distributionUrl 的一些问题橙露1 天前
SpringBoot 全局异常处理:优雅封装统一返回格式awei09161 天前
MinIO配置自定义crossdomain.xml跨域策略(Nginx反向代理实现)谁怕平生太急1 天前
面试题记录:在线数据迁移木井巳1 天前
【递归算法】组合总和消失的旧时光-19431 天前
Spring Boot 入门实战(二):用户注册接口设计(Controller + DTO + Validation)