mysql 5.7.34 gtid 复制模式下执行 reset master 命令后 slave 节点的处理

摘要:
上一个IO_错误:192.168.56.60Master _用户:replicatorMaster_端口:node2-relay-bin.000002中继_日志_位置:

问题描述

主从同步报如下错误:

Last_IO_Error: Got fatal error 1236 from master when reading data from binary log: ‘Slave has more GTIDs than the master has, using the master’s SERVER_UUID. This may indicate that the end of the binary log was truncated or that the last binary log file was lost, e.g., after a power or disk failure when sync_binlog != 1. The master may or may not have rolled back transactions that were already replicated to the slave. Suggest to replicate any transactions that master has rolled back from slave to master, and/or commit empty transactions on master to account for transactions that have been’

系统环境

os: centos 7.4
db: mysql 5.7.34

192.168.56.60 node1 # master
192.168.56.61 node2 # slave

处理过程

[root@node2 ~]# cat /etc/centos-release
CentOS Linux release 7.4.1708 (Core)
[root@node2 ~]# mysql
Welcome to the MySQL monitor. Commands end with ; or g.
Your MySQL connection id is 19
Server version: 5.7.34 MySQL Community Server - GPL

Copyright (c) 2000, 2020, Oracle and/or its affiliates. All rights reserved.

Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.

Type 'help;' or 'h' for help. Type 'c' to clear the current input statement.

mysql> select version();
+-----------+
| version() |
+-----------+
| 8.0.19 |
+-----------+
1 row in set (0.00 sec)

reset master
mysql> reset master;
Query OK, 0 rows affected (0.38 sec)

mysql> show master status;
+---------------+----------+--------------+--------------------------------------------------+-------------------+
| File | Position | Binlog_Do_DB | Binlog_Ignore_DB | Executed_Gtid_Set |
+---------------+----------+--------------+--------------------------------------------------+-------------------+
| binlog.000001 | 155 | | information_schema,mysql,performation_schema,sys | |
+---------------+----------+--------------+--------------------------------------------------+-------------------+
1 row in set (0.00 sec)

mysql>

mysql> show slave statusG
*************************** 1. row ***************************
Slave_IO_State:
Master_Host: 192.168.56.60
Master_User: replicator
Master_Port: 3306
Connect_Retry: 10
Master_Log_File:
Read_Master_Log_Pos: 4
Relay_Log_File: node2-relay-bin.000002
Relay_Log_Pos: 4
Relay_Master_Log_File:
Slave_IO_Running: No
Slave_SQL_Running: Yes
Replicate_Do_DB:
Replicate_Ignore_DB: information_schema,mysql,performance_schema,sys
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: 0
Relay_Log_Space: 155
Until_Condition: None
Until_Log_File:
Until_Log_Pos: 0
Master_SSL_Allowed: Yes
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: 13114
Last_IO_Error: Got fatal error 1236 from master when reading data from binary log: 'Slave has more GTIDs than the master has, using the master's SERVER_UUID. This may indicate that the end of the binary log was truncated or that the last binary log file was lost, e.g., after a power or disk failure when sync_binlog != 1. The master may or may not have rolled back transactions that were already replicated to the slave. Suggest to replicate any transactions that master has rolled back from slave to master, and/or commit empty transactions on master to account for transactions that have been'
Last_SQL_Errno: 0
Last_SQL_Error:
Replicate_Ignore_Server_Ids:
Master_Server_Id: 5660
Master_UUID: f35f7fd2-5828-11ea-a590-08002799719d
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 more updates
Master_Retry_Count: 86400
Master_Bind:
Last_IO_Error_Timestamp: 200316 17:58:15
Last_SQL_Error_Timestamp:
Master_SSL_Crl:
Master_SSL_Crlpath:
Retrieved_Gtid_Set:
Executed_Gtid_Set: f35f7fd2-5828-11ea-a590-08002799719d:1
Auto_Position: 1
Replicate_Rewrite_DB:
Channel_Name:
Master_TLS_Version:
Master_public_key_path: /var/lib/mysql/public_key.pem
Get_master_public_key: 1
Network_Namespace:
1 row in set (0.00 sec)

Slave_IO_Running: No
Slave_SQL_Running: Yes
Last_IO_Error: Got fatal error 1236 from master when reading data from binary log: ‘Slave has more GTIDs than the master has, using the master’s SERVER_UUID. This may indicate that the end of the binary log was truncated or that the last binary log file was lost, e.g., after a power or disk failure when sync_binlog != 1. The master may or may not have rolled back transactions that were already replicated to the slave. Suggest to replicate any transactions that master has rolled back from slave to master, and/or commit empty transactions on master to account for transactions that have been’

解决方法

1)在从上执行 reset master;

在从库上执行这个命令的作用是 清空从库的 gtid

reset master;

2)然后继续观察,如果还报错就

stop slave;

reset slave;

重新指定主;

start slave;

————————————————
版权声明:本文为CSDN博主「数据库人生」的原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接及本声明。
原文链接:https://blog.csdn.net/ctypyb2002/article/details/104906723/

免责声明:文章转载自《mysql 5.7.34 gtid 复制模式下执行 reset master 命令后 slave 节点的处理》仅用于学习参考。如对内容有疑问,请及时联系本站处理。

上篇python基础知识(理论)Yii路径总结下篇

宿迁高防,2C2G15M,22元/月;香港BGP,2C5G5M,25元/月 雨云优惠码:MjYwNzM=

相关文章

通知栏Notification的整理

一、介绍          通知栏适用于交互事件的通知,是位于顶层可以展开的通知列表。 二、功能作用   1.显示接收到短消息,及时消息等信息(如QQ、微信、新浪、短信)       2.显示客户端的推送消息(如有新版本发布,广告。推荐新闻等)   3.显示正在进行的事物(例如:后台运行的程序)(如音乐播放器、版本更新时候的下载进度等) 三、Notific...

python 获取系统时间,新建时间目录

import datetime import os theTime = datetime.datetime.now() print(theTime) theTime = str(theTime) date_split = theTime.strip().split(' ') date_today = date_split[0].replace('-', '...

Facebook Api 使用(PHP版)

如果想通过Facebook登录到你的网站,Facebook站外API可以实现你想要的,如下介绍实际使用. (我目前没在网上找到中文的更详细的介绍了,呵呵.) (提示:Facebook不支持取得朋友的邮件地址,如果需求是这个,别在浪费功夫了) 注册Facebook Key http://www.facebook.com/developers/apps.php...

mysql集群搭建 (PXC)

一、PXC介绍 1.1 关于PXC PXC(Percona XtraDB Cluster)是MySQL数据库的一种高可用集群策略,与传统的基于主从复制模式的集群架构相比 PXC 最突出特点就是解决了诟病已久的数据复制延迟问题,基本上可以达到实时同步。而且节点与节点之间,他们相互的关系是对等的。PXC 最关注的是数据的一致性,对待事物的行为时,要么在所有节...

python学习笔记(十七)flask模块写接口

1 import flask,json 2 from tools import op_mysql #op_mysql() 3 # 接口,后台服务 4 server = flask.Flask(__name__) #把咱们这个app这个python文件当做一个server 5 @server.route('/get_user',methods=[...

浅析muduo库中的线程设施

muduo是目前我在学习过程中遇到的最具有学习意义的网络库,下文将分析muduo库中的基础设施--Thread和ThreadPool. 首先,介绍在多线程编程中不可缺少的同步措施--Mutex和Condition. Mutex /***Mutex.h***/ class MutexLock : boost::noncopyable { public:...