MySQL GTID复制错误处理之跳过错误
某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复制错误处理之跳过错误的更多相关文章
- MySQL GTID复制Slave跳过错误事务Id以及复制排错问题总结
GTID复制典型的复制错误有两种:1,数据对象级别的错误,包括主库上update的数据在从库上不存在,主从逐渐冲突,库表索引等对象的冲突等等, 如果是纯粹的跳过错误的话,这一类的错误需要跳过思路是 ...
- MySQL GTID复制
什么是GTID 什么是GTID呢, 简而言之,就是全局事务ID(global transaction identifier ),最初由google实现,官方MySQL在5.6才加入该功能.GTID是事 ...
- MYSQL GTID 复制
MySQL5.7以后都基本用GTID方式复制了,相对于binlog和position号方式,在failover时候减少很多人工切换操作 GTID,global transaction identiti ...
- 【3.2】【mysql基本实验】mysql GTID复制(基于空数据的配置)
概述:本质上和传统异步复制没什么区别,就是加了GTID参数. 且可以用传统的方式来配置主从,也可以用GTID的方式来自动配置主从. 这里使用GTID的方式来自动适配主从. 需要mysql5.6.5以上 ...
- MySQL 5.6.10 跨平台GTID复制实践
根据业务需要,建立MySQL复制来实现数据冗余. 1:binlog_format 默认值是:statement 有效值: ROW,基于行的复制 STATEMENT 基于语句级别的复制 MASTER ...
- mysql主从复制跳过错误
mysql主从复制,经常会遇到错误而导致slave端复制中断,这个时候一般就需要人工干预,跳过错误才能继续 跳过错误有两种方式: 1.跳过指定数量的事务: mysql>slave stop; m ...
- (5.8)mysql高可用系列——MySQL中的GTID复制(实践篇)
一.基于GTID的异步复制(一主一从)无数据/少数据搭建 二.基于GTID的无损半同步复制(一主一从)(mysql5.7)基于大数据量的初始化 正文: [0]概念 [0.5]GTID 复制(mysql ...
- mysql主从跳过错误
mysql主从复制,经常会遇到错误而导致slave端复制中断,这个时候一般就需要人工干预,跳过错误才能继续 跳过错误有两种方式: 1.跳过指定数量的事务 mysql>stop slave; m ...
- mysql gtid 第一篇
GTID1 简介 就是全局事务ID(global transaction identifier )2 构成 uuid+transaction_id 3 格式 7a07cd08-ac1b-11 ...
随机推荐
- Koa 框架教程
Koa 框架教程 作者: 阮一峰 日期: 2017年8月 9日 Node 主要用在开发 Web 应用.这决定了使用 Node,往往离不开 Web 应用框架. Koa 就是一种简单好用的 Web 框 ...
- zabbix报错cannot set resource limit: [13] Permission denied解决方法
zabbix-server启动时出现以下错误: 2912:20180326:050930.023 using configuration file: /etc/zabbix/zabbix_server ...
- 【Promise】Promise实现请求超时处理(基本版)
首先是没有加入请求超时的情况: var http = require('http'); var url = require('url'); function get(addr) { return ne ...
- OkHttp3 简述
- 【JAVA】ThreadLocal源码分析
ThreadLocal内部是用一张哈希表来存储: static class ThreadLocalMap { static class Entry extends WeakReference<T ...
- Ubuntu中root的默认密码
原文地址:http://www.cnblogs.com/xuyingying/archive/2008/10/16/1312584.html 安装完Ubuntu后忽然意识到没有设 置root密码,不知 ...
- [TensorFlow] Introducing TensorFlow Feature Columns
Welcome to Part 2 of a blog series that introduces TensorFlow Datasets and Estimators. We're devotin ...
- Struts的FormFile与Commons-FileUpload控件使用心得
转自: http://www.iteye.com/topic/212566 前一段时间刚来公司,看到一个项目中以前有人写的struts代码.是使用了FormFile来处理关于文件上传的模块.但是用力一 ...
- 深入学习使用ocr算法识别图片中文字的方法
公司有个需求,简单点说需要从一张图片中识别出中文,通过python来实现,当然其他程序也行,只要能实现,而小编主要学习python,所以就提了python.一个小白在网上遨游了一天,终于找到一丝丝思绪 ...
- Struts2学习(二)———— 表单参数自动封装和参数类型自动转换
前篇文章对struts2的一个入门,重点是对struts2的架构图有一个大概的了解即可,之后的几篇文章,就是细化struts2,将struts2中的各种功能进行梳理,其实学完之后,对struts2的使 ...