某Slave报错信息:

mysql> show slave status\G;
mysql> show slave status\G;
*************************** . row ***************************
Slave_IO_State: Waiting for master to send event
Master_Host: 192.168.206.140
Master_User: u_repl
Master_Port:
Connect_Retry:
Master_Log_File: mysql-bin.
Read_Master_Log_Pos:
Relay_Log_File: localhost-relay-bin.
Relay_Log_Pos:
Relay_Master_Log_File: mysql-bin.
Slave_IO_Running: Yes
Slave_SQL_Running: No
Replicate_Do_DB:
Replicate_Ignore_DB:
Replicate_Do_Table:
Replicate_Ignore_Table:
Replicate_Wild_Do_Table:
Replicate_Wild_Ignore_Table:
Last_Errno:
Last_Error: Coordinator stopped because there were error(s) in the worker(s). The most recent failure being: Worker failed executing transaction '9e2c7c0f-0908-11e7-8230-000c29ab7544:1' at master log mysql-bin., end_log_pos . See error log and/or performance_schema.replication_applier_status_by_worker table for more details about this failure or others, if any.
Skip_Counter:
Exec_Master_Log_Pos:
Relay_Log_Space:
Until_Condition: None
Until_Log_File:
Until_Log_Pos:
Master_SSL_Allowed: No
Master_SSL_CA_File:
Master_SSL_CA_Path:
Master_SSL_Cert:
Master_SSL_Cipher:
Master_SSL_Key:
Seconds_Behind_Master: NULL
Master_SSL_Verify_Server_Cert: No
Last_IO_Errno:
Last_IO_Error:
Last_SQL_Errno:
Last_SQL_Error: Coordinator stopped because there were error(s) in the worker(s). The most recent failure being: Worker failed executing transaction '9e2c7c0f-0908-11e7-8230-000c29ab7544:1' at master log mysql-bin., end_log_pos . See error log and/or performance_schema.replication_applier_status_by_worker table for more details about this failure or others, if any.
Replicate_Ignore_Server_Ids:
Master_Server_Id:
Master_UUID: 9e2c7c0f--11e7--000c29ab7544
Master_Info_File: mysql.slave_master_info
SQL_Delay:
SQL_Remaining_Delay: NULL
Slave_SQL_Running_State:
Master_Retry_Count:
Master_Bind:
Last_IO_Error_Timestamp:
Last_SQL_Error_Timestamp: ::
Master_SSL_Crl:
Master_SSL_Crlpath:
Retrieved_Gtid_Set: 9e2c7c0f--11e7--000c29ab7544:-
Executed_Gtid_Set: 347cbac6--11e7-b957-000c2981a46e:,
c59a2526-08fd-11e7-a5c7-000c296f2953:-
Auto_Position:
Replicate_Rewrite_DB:
Channel_Name:
Master_TLS_Version:
row in set (0.00 sec) ERROR:
No query specified

GTID的复制对于错误信息的可读性不是很好,但可以通过错误代码(1007)从监控表replication_applier_status_by_worker查看:

mysql> select * from performance_schema.replication_applier_status_by_worker where LAST_ERROR_NUMBER=\G
mysql> select * from performance_schema.replication_applier_status_by_worker where LAST_ERROR_NUMBER=\G
*************************** . row ***************************
CHANNEL_NAME:
WORKER_ID:
THREAD_ID: NULL
SERVICE_STATE: OFF
LAST_SEEN_TRANSACTION: 9e2c7c0f--11e7--000c29ab7544:
LAST_ERROR_NUMBER:
LAST_ERROR_MESSAGE: Worker failed executing transaction '9e2c7c0f-0908-11e7-8230-000c29ab7544:1' at master log mysql-bin., end_log_pos ; Error 'Can't create database 'mydb'; database exists' on query. Default database: 'mydb'. Query: 'create database mydb'
LAST_ERROR_TIMESTAMP: -- ::
row in set (0.00 sec)

使用GTID跳过错误的方法:找到错误的GTID跳过(通过Exec_Master_Log_Pos去binlog里找GTID,或则通过上面监控表replication_applier_status_by_worker找到GTID,也可以通过Executed_Gtid_Set算出GTID),这里使用监控表来找到错误的GTID。找到GTID之后,跳过错误的步骤

mysql> stop slave; #停止同步
Query OK, rows affected (0.02 sec) mysql> set @@session.gtid_next='9e2c7c0f-0908-11e7-8230-000c29ab7544:1'; #跳过错误的GTID
Query OK, rows affected (0.00 sec) mysql> begin; #提交一个空事务,因为设置gtid_next后,gtid的生命周期就开始了,必须通过显性的提交一个事务来结束,否则报错:ERROR (HY000): @@SESSION.GTID_NEXT cannot be changed by a client that owns a
Query OK, rows affected (0.00 sec) mysql> commit;
Query OK, rows affected (0.01 sec) mysql> set @@session.gtid_next=automatic; #设置回自动模式
Query OK, rows affected (0.00 sec) mysql> start slave;
Query OK, rows affected (0.02 sec)

再次确认slave同步状况

mysql> show slave status\G;
mysql> show slave status\G;
*************************** . row ***************************
Slave_IO_State: Waiting for master to send event
Master_Host: 192.168.206.140
Master_User: u_repl
Master_Port:
Connect_Retry:
Master_Log_File: mysql-bin.
Read_Master_Log_Pos:
Relay_Log_File: localhost-relay-bin.
Relay_Log_Pos:
Relay_Master_Log_File: mysql-bin.
Slave_IO_Running: Yes
Slave_SQL_Running: Yes
Replicate_Do_DB:
Replicate_Ignore_DB:
Replicate_Do_Table:
Replicate_Ignore_Table:
Replicate_Wild_Do_Table:
Replicate_Wild_Ignore_Table:
Last_Errno:
Last_Error:
Skip_Counter:
Exec_Master_Log_Pos:
Relay_Log_Space:
Until_Condition: None
Until_Log_File:
Until_Log_Pos:
Master_SSL_Allowed: No
Master_SSL_CA_File:
Master_SSL_CA_Path:
Master_SSL_Cert:
Master_SSL_Cipher:
Master_SSL_Key:
Seconds_Behind_Master:
Master_SSL_Verify_Server_Cert: No
Last_IO_Errno:
Last_IO_Error:
Last_SQL_Errno:
Last_SQL_Error:
Replicate_Ignore_Server_Ids:
Master_Server_Id:
Master_UUID: 9e2c7c0f--11e7--000c29ab7544
Master_Info_File: mysql.slave_master_info
SQL_Delay:
SQL_Remaining_Delay: NULL
Slave_SQL_Running_State: Slave has read all relay log; waiting for more updates
Master_Retry_Count:
Master_Bind:
Last_IO_Error_Timestamp:
Last_SQL_Error_Timestamp:
Master_SSL_Crl:
Master_SSL_Crlpath:
Retrieved_Gtid_Set: 9e2c7c0f--11e7--000c29ab7544:-
Executed_Gtid_Set: 347cbac6--11e7-b957-000c2981a46e:,
9e2c7c0f--11e7--000c29ab7544:-,
c59a2526-08fd-11e7-a5c7-000c296f2953:-
Auto_Position:
Replicate_Rewrite_DB:
Channel_Name:
Master_TLS_Version:
row in set (0.00 sec) ERROR:
No query specified

打完收工

本文地址:http://www.cnblogs.com/ajiangg/p/6558714.html

MySQL GTID复制错误处理之跳过错误的更多相关文章

  1. MySQL GTID复制Slave跳过错误事务Id以及复制排错问题总结

    GTID复制典型的复制错误有两种:1,数据对象级别的错误,包括主库上update的数据在从库上不存在,主从逐渐冲突,库表索引等对象的冲突等等,   如果是纯粹的跳过错误的话,这一类的错误需要跳过思路是 ...

  2. MySQL GTID复制

    什么是GTID 什么是GTID呢, 简而言之,就是全局事务ID(global transaction identifier ),最初由google实现,官方MySQL在5.6才加入该功能.GTID是事 ...

  3. MYSQL GTID 复制

    MySQL5.7以后都基本用GTID方式复制了,相对于binlog和position号方式,在failover时候减少很多人工切换操作 GTID,global transaction identiti ...

  4. 【3.2】【mysql基本实验】mysql GTID复制(基于空数据的配置)

    概述:本质上和传统异步复制没什么区别,就是加了GTID参数. 且可以用传统的方式来配置主从,也可以用GTID的方式来自动配置主从. 这里使用GTID的方式来自动适配主从. 需要mysql5.6.5以上 ...

  5. MySQL 5.6.10 跨平台GTID复制实践

    根据业务需要,建立MySQL复制来实现数据冗余. 1:binlog_format   默认值是:statement 有效值: ROW,基于行的复制 STATEMENT 基于语句级别的复制 MASTER ...

  6. mysql主从复制跳过错误

    mysql主从复制,经常会遇到错误而导致slave端复制中断,这个时候一般就需要人工干预,跳过错误才能继续 跳过错误有两种方式: 1.跳过指定数量的事务: mysql>slave stop; m ...

  7. (5.8)mysql高可用系列——MySQL中的GTID复制(实践篇)

    一.基于GTID的异步复制(一主一从)无数据/少数据搭建 二.基于GTID的无损半同步复制(一主一从)(mysql5.7)基于大数据量的初始化 正文: [0]概念 [0.5]GTID 复制(mysql ...

  8. mysql主从跳过错误

    mysql主从复制,经常会遇到错误而导致slave端复制中断,这个时候一般就需要人工干预,跳过错误才能继续 跳过错误有两种方式: 1.跳过指定数量的事务 mysql>stop slave;  m ...

  9. mysql gtid 第一篇

    GTID1 简介   就是全局事务ID(global transaction identifier )2 构成   uuid+transaction_id 3 格式  7a07cd08-ac1b-11 ...

随机推荐

  1. 关于Python的import机制原理

    很多人用过python,不假思索地在脚本前面加上import module_name,但是关于import的原理和机制,恐怕没有多少人真正的理解.本文整理了Python的import机制,一方面自己总 ...

  2. A Painless Q-learning Tutorial (一个 Q-learning 算法的简明教程)

        本文是对 http://mnemstudio.org/path-finding-q-learning-tutorial.htm 的翻译,共分两部分,第一部分为中文翻译,第二部分为英文原文.翻译 ...

  3. 将tomcat添加为linux系统服务

    前言 在博客 --> virtualBox安装centos,并搭建tomcat中,讲到了centos下搭建tomcat环境,发现启动tomcat不是那么方便,要是忘记路径了,那就更麻烦了!当然了 ...

  4. Tomcat8源码笔记(一)Lifecycle接口

    第一次阅读Tomcat8源码,就以Lifecycle作为笔记阅读的开篇吧,一千个读者就有一千个哈姆雷特,每个人都Tomcat的理解都不同,如果不记录一次Tomcat源码可能忘了就忘了. 断断DEBUG ...

  5. Spring之Bean的作用域与生命周期

    在前面博客中提到容器启动获得BeanDefinition对象中有一个scope 属性.该属性控制着bean对象的作用域.本章节介绍Bean的作用域及生命周期,了解bean是怎么来的又怎么没的. 一.B ...

  6. Shell 示例:利用 $RANDOM 产生随机整数

    代码如下: #!/bin/bash # $RANDOM 在每次调用的时候,返回一个不同的随机整数 # 指定的范围是: 0 - 32767 MAXCOUNT=10 count=1 echo echo & ...

  7. C#实现加简单的Http请求

    通过.Net中的两个类 HttpWebRequest 类, HttpWebResponse 类来实现Http的请求,响应处理. 第一个小测试是请求百度首页( http://www.baidu.com ...

  8. CASE函数

    -> 使用类似switch-case与if-else if -> 语法 •case [字段] •    when 表达式 then 显示数据 •    when 表达式 then 显示数据 ...

  9. bootstrap-multiselect 多选

    官方教程 http://www.kuitao8.com/demo/20140224/1/bootstrap-multiselect-master/index.html 使用方法: 第一步引用样式以及相 ...

  10. .NET实现发送邮件

    注意:需要找到“POP3/SMTP服务”并开启,然后生成授权码,生成的授权码就是下面登入的密码. /// <summary> /// 发送邮件 /// </summary> / ...