您好,欢迎来到三六零分类信息网!老站,搜索引擎当天收录,欢迎发信息

mysql主从不同步问题分析

2024/3/22 3:23:04发布26次查看
查看丛库状态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 '864e6992-0a34-11e7-a98a-7cd30ac6c9ec:148408' at master log mysql-bin.000010, end_log_pos 920578920. see error log and/or performance_schema.replication_applier_status_by_worker table for more details about this failure or others, if any.
1、  按照丛库的提示找原因,输入命令
select * from performance_schema.replication_applier_status_by_worker\g
得到
知道这个事务发生在表 r_com_patent 上,定位到表,但是不知道哪一条记录。
2、 到主库找二进制文件发生了什么事。输入命令
mysqlbinlog --no-defaults –v –v --base64-output=decode-rows /usr/local/mysql/data/master-bin.000010 | grep –a ‘10’ 920578920
终于定位到记录了。
主库在表r_com_patent做了更新操作,而丛库找不到更新的记录。
具体来说就是,主库将表r_com_patent中patent_id为45的记录,字段cid从null更改为3253026.而丛库表r_com_patent中patent_id为45的记录,字段cid原本为3253026,由于复制机制就必须找丛库表r_com_patent中patent_id为45并且id为null的记录,所以没找到。。。
3、 解决方法
1) 在master查看那条记录。
select * from r_com_patent where patent_id = 45;
2) 在slave上,查找下更新后的那条记录,应该是不存在的。
select * from r_com_patent where patent_id = 45;
3) 把丢失的数据在slave上填补或是修改。
insert into r_com_patent values(3253026,45);
4) 在slave跳过报错的事务。
stop slave; set @@session.gtid_next=’ 864e6992-0a34-11e7-a98a-7cd30ac6c9ec:148408’ begin; commit; set @@session.gtid_next = automatic; start slave;
之后,再检查一遍
show slave status\g
以上就是mysql主从不同步问题分析的详细内容。
该用户其它信息

VIP推荐

免费发布信息,免费发布B2B信息网站平台 - 三六零分类信息网 沪ICP备09012988号-2
企业名录 Product