MySQL8.0主从同步报ERROR 13121错误解决方法

由于平台虚拟机宿主机迁移,导致一套MySQL主从库从节点故障,从节点服务终止,在服务启动后,恢复从节点同步服务,发现了如下报错:

mysql> show slave status\G;
*************************** 1. row ***************************
               Slave_IO_State: Waiting for master to send event
                  Master_Host: XXXX
                  Master_User: cdbsync
                  Master_Port: 3366
                Connect_Retry: 60
              Master_Log_File: mysql-bin.007843
          Read_Master_Log_Pos: 78338072
               Relay_Log_File: nxscjdtsjkmysqlzc-mysql-master-2-367f7-0-relay-bin.023264
                Relay_Log_Pos: 78930577
        Relay_Master_Log_File: mysql-bin.007841
             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: 13121
                   Last_Error: Relay log read failure: Could not parse relay log event entry. The possible reasons are: the master's binary log is corrupted (you can check this by running 'mysqlbinlog' on the binary log), the slave's relay log is corrupted (you can check this by running 'mysqlbinlog' on the relay log), a network problem, the server was unable to fetch a keyring key required to open an encrypted relay log file, or a bug in the master's or slave's MySQL code. If you want to check the master's binary log or slave's relay log, you will be able to know their names by issuing 'SHOW SLAVE STATUS' on this slave.
                 Skip_Counter: 0
          Exec_Master_Log_Pos: 78930363
              Relay_Log_Space: 300215564
              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: 13121
               Last_SQL_Error: Relay log read failure: Could not parse relay log event entry. The possible reasons are: the master's binary log is corrupted (you can check this by running 'mysqlbinlog' on the binary log), the slave's relay log is corrupted (you can check this by running 'mysqlbinlog' on the relay log), a network problem, the server was unable to fetch a keyring key required to open an encrypted relay log file, or a bug in the master's or slave's MySQL code. If you want to check the master's binary log or slave's relay log, you will be able to know their names by issuing 'SHOW SLAVE STATUS' on this slave.
  Replicate_Ignore_Server_Ids: 
             Master_Server_Id: 2887743427
                  Master_UUID: e4a6bc6b-9de0-11eb-b5e2-fa163e5aaa5e
             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: 241016 02:50:23
               Master_SSL_Crl: 
           Master_SSL_Crlpath: 
           Retrieved_Gtid_Set: e4a6bc6b-9de0-11eb-b5e2-fa163e5aaa5e:1-9339028
            Executed_Gtid_Set: e4a6bc6b-9de0-11eb-b5e2-fa163e5aaa5e:1-9337179
                Auto_Position: 1
         Replicate_Rewrite_DB: 
                 Channel_Name: 
           Master_TLS_Version: 
       Master_public_key_path: 
        Get_master_public_key: 1
            Network_Namespace: 
1 row in set (0.00 sec)

ERROR: 
No query specified

mysql>

查看报错信息,提示由于日志损坏、网络问题或bug导致无法获取中继日志中的事件信息。
在尝试了跳过从节点错误方法后,依旧不能正常同步,报错还是一样。
于是,就计划reset slave,重新从中断的日志及position开始复制,整个操作流程如下:

确认Relay_Master_Log_File和Exec_Master_Log_Pos信息:
Relay_Master_Log_File: mysql-bin.007841
Exec_Master_Log_Pos: 78930363

STOP SLAVE;
RESET SLAVE;
CHANGE MASTER TO master_log_file='mysql-bin.007841', master_log_pos=78930363;
START SLAVE;

操作过程:
mysql> stop slave;
Query OK, 0 rows affected, 1 warning (0.00 sec)

mysql> RESET SLAVE;
Query OK, 0 rows affected (0.10 sec)

mysql> CHANGE MASTER TO master_log_file='mysql-bin.007841', master_log_pos=78930363;
ERROR 1776 (HY000): Parameters MASTER_LOG_FILE, MASTER_LOG_POS, RELAY_LOG_FILE and RELAY_LOG_POS cannot be set when MASTER_AUTO_POSITION is active.

根据提示信息,在从节点上设置master_auto_position为0:
mysql> change master to master_auto_position=0;
Query OK, 0 rows affected (0.08 sec)

mysql> CHANGE MASTER TO master_log_file='mysql-bin.007841', master_log_pos=78930363;
Query OK, 0 rows affected (0.06 sec)

重新启动slave:
mysql> 
mysql> start slave;
Query OK, 0 rows affected (0.01 sec)


mysql> stop slave;
Query OK, 0 rows affected (0.03 sec)

同步正常后,将master_auto_position修改为1并重新启动同步:

mysql> change master to master_auto_position=
    -> 1;
Query OK, 0 rows affected (0.05 sec)

mysql> start slave;
Query OK, 0 rows affected (0.02 sec)

mysql> show slave status\G;
*************************** 1. row ***************************
               Slave_IO_State: Waiting for master to send event
                  Master_Host: XXXX
                  Master_User: cdbsync
                  Master_Port: 3366
                Connect_Retry: 60
              Master_Log_File: mysql-bin.007843
          Read_Master_Log_Pos: 79142894
               Relay_Log_File: nxscjdtsjkmysqlzc-mysql-master-2-367f7-0-relay-bin.000002
                Relay_Log_Pos: 10529
        Relay_Master_Log_File: mysql-bin.007843
             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: 79142894
              Relay_Log_Space: 10772
              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: 2887743427
                  Master_UUID: e4a6bc6b-9de0-11eb-b5e2-fa163e5aaa5e
             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: 
     Last_SQL_Error_Timestamp: 
               Master_SSL_Crl: 
           Master_SSL_Crlpath: 
           Retrieved_Gtid_Set: e4a6bc6b-9de0-11eb-b5e2-fa163e5aaa5e:9339373-9339378
            Executed_Gtid_Set: e4a6bc6b-9de0-11eb-b5e2-fa163e5aaa5e:1-9339378
                Auto_Position: 1
         Replicate_Rewrite_DB: 
                 Channel_Name: 
           Master_TLS_Version: 
       Master_public_key_path: 
        Get_master_public_key: 1
            Network_Namespace: 
1 row in set (0.00 sec)

ERROR: 
No query specified

mysql> 

至此,整个同步报错处理完成。
 

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.rhkb.cn/news/452317.html

如若内容造成侵权/违法违规/事实不符,请联系长河编程网进行投诉反馈email:809451989@qq.com,一经查实,立即删除!

相关文章

Linux 外设驱动 应用 2 KEY 按键实验

2 按键 2.1 按键介绍 按键是指轻触式按键开关,也称之为轻触开关。按键开关是一种电子开关,属于电子元器件类,最早出现在日本,称之为:敏感型开关,使用时以满足操作力的条件向开关操作方向施压开关功能闭合…

spring05

一: 场景设定和问题复现 1 准备项目 pom.xml //单元测试:每个业务单独运行 <dependency> <groupId>org.junit.jupiter</groupId> <artifactId>junit-jupiter-api</artifactId> <version>5.3.1</version> <scope>…

民宿预订新纪元:SpringBoot实现的在线平台

1系统概述 1.1 研究背景 随着计算机技术的发展以及计算机网络的逐渐普及&#xff0c;互联网成为人们查找信息的重要场所&#xff0c;二十一世纪是信息的时代&#xff0c;所以信息的管理显得特别重要。因此&#xff0c;使用计算机来管理民宿在线预定平台的相关信息成为必然。开发…

springboot041师生健康信息管理系统(论文+源码)_kaic

摘 要 随着移动应用技术的发展&#xff0c;越来越多的用户借助于移动手机、电脑完成生活中的事务&#xff0c;许多的传统行业也更加重视与互联网的结合。 本论文主要介绍基于java的师生健康信息管理系统&#xff0c;运用软件工程原理和开发方法&#xff0c;采用springboot框架…

Flink时间语义和时间窗口

前言 在实际的流计算业务场景中&#xff0c;我们会发现&#xff0c;数据和数据的计算往往都和时间具有相关性。 举几个例子&#xff1a; 直播间右上角通常会显示观看直播的人数&#xff0c;并且这个数字每隔一段时间就会更新一次&#xff0c;比如10秒。电商平台的商品列表&a…

VSCode自搭建嵌入式环境的make构建工具选择

make构建工具即make.exe。 make.exe作为环境变量&#xff0c;和Makefile脚本同步协作&#xff0c;Makefile里面的语法规定了代码项目中多文件的编译顺序和编译规则。 ①MinGW-64&#xff1a;如果选择MinGW/bin文件目录下的mingw32-make.exe&#xff0c;将其重命名为make.exe&a…

2.cpp输入输出

cpp输入输出 1.cpp输入输出 1.cpp输入输出 项目中需要用到中文提示&#xff0c;需要去设置中更改字符编码为GBK&#xff0c;不然程序会乱码 注意&#xff1a;先设置编码格式&#xff0c;再创建工程 C 中的输入和输出&#xff08;I/O&#xff09;主要是通过标准库中的输入输出…

scala 抽象类

理解抽象类 抽象的定义 定义一个抽象类 &#xff1a;abstract class A {} idea实例 抽象类重写 idea实例 练习 1.abstract2.错3.abstract class A{}4.对

GROUP BY分组

1. 插入测试数据 INSERT INTO course (course_name,teacher_id) VALUES (毛概,1)&#xff0c; (线性代数,2)&#xff0c; (政治&#xff0c;3)&#xff0c; (程序设计语言,1)&#xff0c; (离散数学,2)&#xff0c; (编译技术,3)&#xff0c; (嵌入式基础,1)&#xff0c; (单片…

element plus中menu菜单技巧

我在使用element plus的menu&#xff08;侧边栏&#xff09;组件的过程中遇到了一些问题&#xff0c;就是menu编写样式和路由跳转&#xff0c;下面给大家分享以下&#xff0c;我是怎么解决的。 1.页面效果 我要实现的网站布局是这样的&#xff1a; 侧边栏折叠以后的效果&#…

C++数据结构-红黑树全面解读(进阶篇)

1.红黑树的概念 红黑树是一种二叉搜索树&#xff0c;但在每个结点上增加了一个存储位用于表示结点的颜色&#xff0c;这个颜色可以是红色的&#xff0c;也可以是黑色的&#xff0c;因此我们称之为红黑树。 红黑树通过对任何一条从根到叶子的路径上各个结点着色方式的限制&…

el-table表格里面有一条横线

表格里面 有一条横线&#xff0c; 出现原因&#xff1a;是自定义了表格头.使用了固定列&#xff08;fixed&#xff09;&#xff0c;定宽。就很难受。。。 添加样式文件&#xff1a; <style lang"scss" scoped>::v-deep {.el-table__fixed-right {height: 100%…

【STL】string类的使用

&#x1f31f;&#x1f31f;作者主页&#xff1a;ephemerals__ &#x1f31f;&#x1f31f;所属专栏&#xff1a;C、STL 目录 string类的介绍--为什么学习string类 一、string类的默认成员函数 构造函数(constructor) 析构函数(destructor) 赋值运算符重载operator 二…

java maven

参考链接 maven相关配置 maven依赖管理 依赖具有传递性。 maven依赖范围 maven的生命周期 分为三个相互独立的生命周期&#xff1a; 在执行对应生命周期的操作时&#xff0c;需要进行前面的操作。比如&#xff0c;执行打包install的时候&#xff0c;会执行test。

嵌入式入门学习——8基于Protues仿真Arduino+SSD1306液晶显示数字时钟

0 系列文章入口 嵌入式入门学习——0快速入门&#xff0c;Let‘s Do It&#xff01; SSD1306 1 Protues查找SSD1306器件并放置在画布&#xff0c;画好电气连接&#xff08;这里VCC和GND画反了&#xff0c;后面仿真出错我才看见&#xff0c;要是现实硬件估计就烧毁了&#xf…

抖音快手提取COOKIE双参软件-修行者编程技术网

抖音快手提取COOKIE双参软件-修行者编程技术网 我们在软件开发的过程中首先要知道&#xff0c;什么是ck&#xff0c;什么是双参数 为什么会有ck&#xff0c;ck是否存在算法在其中 UI代码工程展示

【火山引擎】调用火山大模型的方法 | SDK安装 | 配置 | 客户端初始化 | 设置

豆包 (Doubao) 是字节跳动研发的大规模预训练语言模型。 目录 1 安装 2 配置访问凭证 3 客户端初始化 4 设置地域和访问域名 5 设置超时/重试次数 1 安装 通过pip安装PYTHON SDK。 pip install volcengine-python-sdk[ark] 2 配置访问凭证 获取 API Key 访问凭证具体步…

【NOIP提高组】一元三次方程求解

【NOIP提高组】一元三次方程求解 &#x1f490;The Begin&#x1f490;点点关注&#xff0c;收藏不迷路&#x1f490; 有形如&#xff1a;ax3bx2cxd0 这样的一个一元三次方程。给出该方程中各项的系数(a&#xff0c;b&#xff0c;c&#xff0c;d均为实数)&#xff0c;并约定该方…

PyQt 入门教程(3)基础知识 | 3.1、使用QtDesigner创建.ui文件

文章目录 一、使用QtDesigner创建.ui文件1、创建.ui文件2、生成.py文件3、使用新生成的.py文件4、编辑新生成的.py文件 一、使用QtDesigner创建.ui文件 1、创建.ui文件 打开PyCharm&#xff0c;使用自定义外部工具QtDesigner创建mydialog.ui文件&#xff0c;如下&#xff1a; …

基于因果推理的强对流降水临近预报问题研究

我国地域辽阔&#xff0c;自然条件复杂&#xff0c;灾害性天气种类繁多&#xff0c;地区差异性大。雷雨大风、冰雹、短时强降水等强对流天气是造成经济损失、危害生命安全最严重的一类灾害性天气。由于强对流降水具有高强度、小空间尺度等特点&#xff0c;一直是气象预报领域的…