问一下老师我的配置文件如下,是按照视频课配置的。现在是主库可以插入,但从库不同步。可能是什么问题

来源:9-9 主从数据库实践2

闲庭信步666

2021-04-15

问一下老师我的配置文件如下,是按照视频课配置的。现在是主库可以插入,但从库不同步。可能是什么问题

#数据源配置
spring.shardingsphere.datasource.names=primary-ds,replica-ds-0

spring.shardingsphere.datasource.common.type=com.zaxxer.hikari.HikariDataSource
spring.shardingsphere.datasource.common.driver-class-name=com.mysql.jdbc.Driver
spring.shardingsphere.datasource.common.username=root
spring.shardingsphere.datasource.common.password=14529f1e73f9

写数据源名称

spring.shardingsphere.datasource.primary-ds.jdbc-url=jdbc:mysql://124.70.136.139:3307/ds0?serverTimezone=UTC&useSSL=false&useUnicode=true&characterEncoding=UTF-8

读数据源名称,多个从数据源用逗号分隔

spring.shardingsphere.datasource.replica-ds-0.jdbc-url=jdbc:mysql://124.70.136.139:3308/ds0?serverTimezone=UTC&useSSL=false&useUnicode=true&characterEncoding=UTF-8

spring.shardingsphere.rules.read-write-splitting.data-sources.pr_ds.write-data-source-name=primary-ds
spring.shardingsphere.rules.read-write-splitting.data-sources.pr_ds.read-data-source-names=replica-ds-0
spring.shardingsphere.rules.read-write-splitting.data-sources.pr_ds.load-balancer-name=round-robin

负载均衡算法配置

spring.shardingsphere.rules.read-write-splitting.load-balancers.round-bin.type=ROUND_ROBIN
spring.shardingsphere.rules.read-write-splitting.load-balancers.round-bin.props.default=0

spring.shardingsphere.props.sql-show=true

写回答

2回答

网络时空

2021-05-25

正常搭建好主从库环境就不会有问题了,我自己单独搭建好的主从库

0
0

廖师兄

2021-04-15

从你这配置看不出问题。主从库是通过binlog实现数据同步的。docker搭建方式一样吗。注意网络是否通畅

0
2
Bluse666
回复
闲庭信步666
B站搜 狂神说 他主页看看,可能有你想要的有解决方案
2021-05-17
共2条回复

Java分布式系统解决方案 掌握企业级分布式项目方案

分布式六大命门逐一剖析破解,廖师兄带你寻找最优解

495 学习 · 97 问题

查看课程