ShardingSphere主从复制遇到的问题

1、 Slave_SQL_Running: No

问题描述

SHOW SLAVE STATUS\G
在这里插入图片描述

Last_Error字段报错:

Coordinator stopped because there were error(s) in the worker(s).  The most recent failure being: Worker 1 failed executing transaction 'ANONYMOUS' at master log binlog. 000008, end_log_pos 725.  See error log and/or performance_schema. replication_applier_status_by_worker table for more details about this failure or others, if any

查询performance_schema库下的replication_applier_status_by_worker表,看到

Worker 1 failed executing transaction ‘ANONYMOUS’ at master log binlog.000008, end_log_pos 725; Error ‘Unknown table ‘db_user.t_user’’ on query. Default database: ‘db_user’. Query: ‘DROP TABLE t_user /* generated by server */’

解决

-- 查看从服务的状态
SHOW SLAVE STATUS\G

-- 查看最新的主服务信息,更新change SQL的对应值
SHOW MASTER STATUS;

-- 停止同步
STOP SLAVE;

-- 修改主服务的值,此操作为手动同步
CHANGE MASTER TO MASTER_HOST='192.168.229.128', 
MASTER_USER='dk_slave',MASTER_PASSWORD='123456', MASTER_PORT=3307,
MASTER_LOG_FILE='binlog.000010',MASTER_LOG_POS=157;

-- 开启同步
START SLAVE;

2、手动同步值报错

问题描述

执行

CHANGE MASTER TO MASTER_HOST='192.168.229.128', 
MASTER_USER='dk_slave',MASTER_PASSWORD='123456', MASTER_PORT=3307,
MASTER_LOG_FILE='binlog.000010',MASTER_LOG_POS=157;

报错

CHANGE MASTER cannot be executed when the slave was stopped with an error or killed in MTS mode. Consider using RESET SLAVE or START SLAVE UNTIL

解决

sql执行

RESET SLAVE;

-- 停止同步
STOP SLAVE;

-- 修改主服务的值,此操作为手动同步
CHANGE MASTER TO MASTER_HOST='192.168.229.128', 
MASTER_USER='dk_slave',MASTER_PASSWORD='123456', MASTER_PORT=3307,
MASTER_LOG_FILE='binlog.000010',MASTER_LOG_POS=157;

-- 开启同步
START SLAVE;
  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 2
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

不积跬步无以至千里-陕西西安

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值