基于GTID Replication主从数据不一致操作
+------+
| id |
+------+
| 1 |
| 2 |
| 4 |
+------+
3 rows in set (0.00 sec)
set sql_log_bin=OFF;
insert into t1 values(5);
set sql_log_bin=ON;
insert into t1 values(6);
mysql> select * from t1;
+------+
| id |
+------+
| 1 |
| 2 |
| 4 |
| 5 |
| 6 |
+------+
5 rows in set (0.00 sec)
mysql> select * from testdb.t1;
+------+
| id |
+------+
| 1 |
| 2 |
| 4 |
| 6 |
+------+
4 rows in set (0.00 sec)
update t1 set id=7 where id=5;
insert into t1 values(8); mysql> select * from t1;
+------+
| id |
+------+
| 1 |
| 2 |
| 4 |
| 7 |
| 6 |
| 8 |
+------+
6 rows in set (0.00 sec)
mysql> select * from testdb.t1;
+------+
| id |
+------+
| 1 |
| 2 |
| 4 |
| 6 |
+------+
4 rows in set (0.00 sec)
mysql> show slave status\G
*************************** 1. row ***************************
Slave_IO_State: Waiting for master to send event
Master_Host: 192.168.203.135
Master_User: replmonitor
Master_Port: 3306
Connect_Retry: 60
Master_Log_File: host2-bin.000002
Read_Master_Log_Pos: 1146
Relay_Log_File: host3-relay-bin.000003
Relay_Log_Pos: 648
Relay_Master_Log_File: host2-bin.000002
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: 1032
Last_Error: Could not execute Update_rows event on table testdb.t1; Can't find record in 't1', Error_code: 1032; handler error HA_ERR_END_OF_FILE; the event's master log host2-bin.000002, end_log_pos 875
Skip_Counter: 0
Exec_Master_Log_Pos: 660
Relay_Log_Space: 1595
Until_Condition: None
Until_Log_File:
Until_Log_Pos: 0
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: 0
Last_IO_Error:
Last_SQL_Errno: 1032
Last_SQL_Error: Could not execute Update_rows event on table testdb.t1; Can't find record in 't1', Error_code: 1032; handler error HA_ERR_END_OF_FILE; the event's master log host2-bin.000002, end_log_pos 875
Replicate_Ignore_Server_Ids:
Master_Server_Id: 2
Master_UUID: cd32a980-2a97-11e5-a344-000c2954ccde
Master_Info_File: mysql.slave_master_info
SQL_Delay: 0
SQL_Remaining_Delay: NULL
Slave_SQL_Running_State:
Master_Retry_Count: 86400
Master_Bind:
Last_IO_Error_Timestamp:
Last_SQL_Error_Timestamp: 150717 23:51:51
Master_SSL_Crl:
Master_SSL_Crlpath:
Retrieved_Gtid_Set: cd32a980-2a97-11e5-a344-000c2954ccde:1-3
Executed_Gtid_Set: cd32a980-2a97-11e5-a344-000c2954ccde:1
Auto_Position: 1
1 row in set (0.00 sec)
2015-07-17 23:51:51 30750 [Warning] Slave: Can't find record in 't1' Error_code: 1032
2015-07-17 23:51:51 30750 [ERROR] Error running query, slave SQL thread aborted. Fix the problem, and restart the slave SQL thread with "SLAVE START". We stopped at log 'host2-bin.000002' position 660
mysql> stop slave;
Query OK, 0 rows affected (0.02 sec) mysql> set gtid_next='cd32a980-2a97-11e5-a344-000c2954ccde:2';
Query OK, 0 rows affected (0.00 sec) mysql> begin;
Query OK, 0 rows affected (0.00 sec) mysql> commit;
Query OK, 0 rows affected (0.00 sec) mysql> set gtid_next='AUTOMATIC';
Query OK, 0 rows affected (0.00 sec) mysql> start slave;
Query OK, 0 rows affected (0.01 sec) 即跳过有错误的GTID编号
mysql> show slave status\G
*************************** 1. row ***************************
Slave_IO_State: Waiting for master to send event
Master_Host: 192.168.203.135
Master_User: replmonitor
Master_Port: 3306
Connect_Retry: 60
Master_Log_File: host2-bin.000002
Read_Master_Log_Pos: 1146
Relay_Log_File: host3-relay-bin.000005
Relay_Log_Pos: 688
Relay_Master_Log_File: host2-bin.000002
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: 0
Last_Error:
Skip_Counter: 0
Exec_Master_Log_Pos: 1146
Relay_Log_Space: 1429
Until_Condition: None
Until_Log_File:
Until_Log_Pos: 0
Master_SSL_Allowed: No
Master_SSL_CA_File:
Master_SSL_CA_Path:
Master_SSL_Cert:
Master_SSL_Cipher:
Master_SSL_Key:
Seconds_Behind_Master: 0
Master_SSL_Verify_Server_Cert: No
Last_IO_Errno: 0
Last_IO_Error:
Last_SQL_Errno: 0
Last_SQL_Error:
Replicate_Ignore_Server_Ids:
Master_Server_Id: 2
Master_UUID: cd32a980-2a97-11e5-a344-000c2954ccde
Master_Info_File: mysql.slave_master_info
SQL_Delay: 0
SQL_Remaining_Delay: NULL
Slave_SQL_Running_State: Slave has read all relay log; waiting for the slave I/O thread to update it
Master_Retry_Count: 86400
Master_Bind:
Last_IO_Error_Timestamp:
Last_SQL_Error_Timestamp:
Master_SSL_Crl:
Master_SSL_Crlpath:
Retrieved_Gtid_Set: cd32a980-2a97-11e5-a344-000c2954ccde:1-3
Executed_Gtid_Set: cd32a980-2a97-11e5-a344-000c2954ccde:1-3
Auto_Position: 1
1 row in set (0.00 sec) mysql> select * from testdb.t1;
+------+
| id |
+------+
| 1 |
| 2 |
| 4 |
| 6 |
| 8 |
+------+
5 rows in set (0.00 sec)
基于GTID Replication主从数据不一致操作的更多相关文章
- 基于GTID搭建主从MySQL
目录 基于gtid搭建主从MySQL 一.GTID的使用 二.GTID的简介 三.GTID的构成 四.查看GTID的执行情况 4.1 gtid_executed 4.2 gtid_own 4.3 gt ...
- MySQL多字节字符集造成主从数据不一致问题
MySQL多字节字符集造成主从数据不一致问题 来自江羽 2013-04-27 16:03:56| 分类: 默认分类|举报|字号 订阅 转载: http://backend.blog.163.co ...
- pt-table-checksum检验主从数据不一致
测试环境:主从架构,操作系统liunx 运行pt-table-checksum需要先安装以下依赖包: yum install perl-IO-Socket-SSL perl-DBD-MySQL per ...
- mysql 主从 数据不一致
用pt-table-checksum校验数据一致性 Jun 4th, 2013 主从数据的一致性校验是个头疼的问题,偶尔被业务投诉主从数据不一致,或者几个从库之间的 数据不一致,这会令人沮丧.通常我们 ...
- 揭秘MySQL主从数据不一致
前言: 目前MySQL数据库最常用的是主从架构,大多数高可用架构也是通过主从架构演变而来.但是主从架构运行时间长久后容易出现数据不一致的情况,比如因从库可写造成的误操作或者复制bug等,本篇文章将会详 ...
- mysql]一次主从数据不一致的问题解决过程()
问题 要解决问题就是怎么对比不一致,然后在不影响业务的情况下,修复数据不一致的问题,把从库缺少的数据补上 下面是能想到和找到的几个方案 1 从新从0开始同步,虽然对主库的使用没有影响,但是那么大的数据 ...
- [mysql]一次主从数据不一致的问题解决过程
之前一篇: 主从更换ip之后重新建立同步 情况时这样的 昨天晚上主动2个机器都迁移了,然后今天才把主动重新连接上,但是从库的偏移量是从今天当前时刻开始的,也就是说虽然现在主动看似正常,其实是少了昨天的 ...
- 基于GTID的主从架构异常处理流程
通常情况下我们主库的binlog只保留7天,如果从库故障超过7天以上的数据没有同步的话,那么主从架构就会异常,需要重新搭建主从架构. 本文就简单说明下如何通过mysqldump主库的数据恢复从库的主从 ...
- mysql 主从数据不一致 Slave_SQL_Running: No 解决方法
在slave服务器上通过如下命令 mysql> show slave status\G; 显示如下情况: Slave_IO_Running: Yes Slave_SQL_Running: No ...
随机推荐
- Bencode的编码与解码
开源地址: https://github.com/CreateChen/Bencode Nuget: Install-Package Bencode 1. Bencode规则 BEncoding是Bi ...
- Android Launcher分析和修改13——实现Launcher编辑模式(1) 壁纸更换
已经很久没更新Launcher系列文章,今天不分析源码,讲讲如何在Launcher里面添加桌面设置的功能.目前很多第三方Launcher或者定制Rom都有简单易用的桌面设置功能.例如小米MIUI的La ...
- 解决eclipse使用Search弹出错误问题
在eclipse中搜索时,搜索完之后有时候会弹出错误对话框,虽然错误内容有时候不同,但是解决办法都一样. 这个问题是由于eclipse中文件不同步引起的.在eclipse中,工程文件是由eclipse ...
- Ant自动编译打包&发布 android项目
Eclipse用起来虽然方便,但是编译打包android项目还是比较慢,尤其将应用打包发布到各个渠道时,用Eclipse手动打包各种渠道包就有点不切实际了,这时候我们用到Ant帮我们自动编译打包了. ...
- Python: 收集所有命名参数
有时候把Python函数调用的命名参数都收集到一个dict中可以更方便地做参数检查,或者直接由参数创建attribute等.更简单的理解就是def foo(*args, **kwargs): pass ...
- Window 通过cmd查看端口占用、相应进程、杀死进程等的命令【转】
一. 查看所有进程占用的端口 在开始-运行-cmd,输入:netstat –ano可以查看所有进程 二.查看占用指定端口的程序 当你在用tomcat发布程序时,经常会遇到端口被占用的情况,我们想知 ...
- [Javascript] Functor Basic Intro
Well, this stuff will be a little bit strange if you deal with it first time. Container Object: Just ...
- struts2:异常处理
Struts2框架提供了自己的异常处理机制,只需要在struts.xml文件中配置异常处理即可,而不需要在Action方法中来捕捉异常. 传统方法 public String execute() th ...
- 同步与异步&阻塞与非阻塞
摘要 一直为同步异步,阻塞非阻塞概念所困扰,特定总结了下,原来是这么个意思 一直为同步异步,阻塞非阻塞概念所困扰,特定总结了下 一.同步与异步的区别 1.概念介绍 同步:所谓同步是一个服务的完成需要依 ...
- SASS用法指南-转
作者: 阮一峰 日期: 2012年6月19日 原文地址:http://www.ruanyifeng.com/blog/2012/06/sass.html 艹,没想到sass 2012年就有了.现在 ...