【MySQL】Last_SQL_Errno: 1594Relay log read failure: Could not parse relay log event entry...问题总结处理
备库报错:
Last_SQL_Errno: 1594
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, 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.
遇到这个问题
处理方法就是重新修下下binlog和pos值,从一个新的值重新备份,但有一个问题需要注意,这样的备库数据是最新的,但不是最全的,从pos之前的数据就没有了。
步骤如下:
1.关闭slave(备库操作)
(root@localhost:)[(none)]> stop slave;
Query OK, 0 rows affected (0.04 sec)
2.查看master的binlog和pos值(在主服操作)
(root@localhost:)[(none)]> show master status ;
+------------------+----------+--------------+------------------+-------------------+
| File | Position | Binlog_Do_DB | Binlog_Ignore_DB | Executed_Gtid_Set |
+------------------+----------+--------------+------------------+-------------------+
| mysql-bin.045602 | 63365507 | | | |
+------------------+----------+--------------+------------------+-------------------+
3.修改slave的pos和binlog值
(root@localhost:)[(none)]> change master to master_log_file='mysql-bin.045602 ',master_log_pos= 63365507;
Query OK, 0 rows affected, 33837 warnings (9.37 sec)
4.启动slave
(root@localhost:)[(none)]> start slave;
Query OK, 0 rows affected (0.04 sec)
5.查看状态(备库)
(root@localhost:)[(none)]> show slave status \G;
两个yes,而且没有error 证明成功
下面验证下备库是否为最新的
现在搭建好两个mysql数据库
版本为:/usr/local/mysql3307/bin/mysql Ver 14.14 Distrib 5.7.31, for linux-glibc2.12 (x86_64) using EditLine wrapper
暂时先不开启主从,在主库中添加一个表,并创建一些测试数据
主库:
mysql> use test;
Database changed
mysql> show create table t1\G;;
*************************** 1. row ***************************
Table: t1
Create Table: CREATE TABLE `t1` (
`id` int(11) DEFAULT NULL,
`name` varchar(10) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1
1 row in set (0.00 sec)
ERROR:
No query specified
ERROR:
No query specified
mysql> insert into t1(id,name) values(1,"zhang");
Query OK, 1 row affected (0.01 sec)
mysql> insert into t1(id,name) values(2,"zhan");
Query OK, 1 row affected (0.01 sec)
mysql> insert into t1(id,name) values(3,"zha");
Query OK, 1 row affected (0.01 sec)
mysql> insert into t1(id,name) values(4,"1111");
Query OK, 1 row affected (0.01 sec)
mysql> select * from t1;
+------+-------+
| id | name |
+------+-------+
| 1 | zhang |
| 2 | zhan |
| 3 | zha |
| 4 | 1111 |
+------+-------+
4 rows in set (0.01 sec)
从库配置好,并且是创建完表之后的数据
mysql> show master status;
+------------------+----------+--------------+------------------+-------------------+
| File | Position | Binlog_Do_DB | Binlog_Ignore_DB | Executed_Gtid_Set |
+------------------+----------+--------------+------------------+-------------------+
| binarylog.000003 | 2645011 | | | |
+------------------+----------+--------------+------------------+-------------------+
1 row in set (0.00 sec)
从库配置完my.cnf重启后
执行
mysql> change master to master_host='192.168.25.11',master_user='test',master_port=3306,master_password='test123',master_log_file='binarylog.000003',master_log_pos=2645011;
Query OK, 0 rows affected, 2 warnings (0.01 sec)
查看状态,确认没问题
mysql> show slave status\G;
然后在主库的t1表中,继续添加数据
mysql> insert into t1(id,name) values(5,"test5");
Query OK, 1 row affected (0.00 sec)
切换到从库中,查看是否自动备份
mysql> show slave status\G;
*************************** 1. row ***************************
Slave_IO_State: Waiting for master to send event
Master_Host: 192.168.25.11
Master_User: test
Master_Port: 3306
Connect_Retry: 60
Master_Log_File: binarylog.000003
Read_Master_Log_Pos: 2647526
Relay_Log_File: mysql-slave-relay-bin.000002
Relay_Log_Pos: 320
Relay_Master_Log_File: binarylog.000003
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: 1146
Last_Error: Error executing row event: 'Table 'test.t1' doesn't exist'
Skip_Counter: 0
Exec_Master_Log_Pos: 2647264
Relay_Log_Space: 795
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: 1146
Last_SQL_Error: Error executing row event: 'Table 'test.t1' doesn't exist'
Replicate_Ignore_Server_Ids:
Master_Server_Id: 2
Master_UUID: cd262711-c528-11ea-9399-000c29a68d4e
Master_Info_File: /data/3307/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: 200713 20:07:58
Master_SSL_Crl:
Master_SSL_Crlpath:
Retrieved_Gtid_Set:
Executed_Gtid_Set:
Auto_Position: 0
Replicate_Rewrite_DB:
Channel_Name:
Master_TLS_Version:
1 row in set (0.00 sec)
ERROR:
No query specified
提示数据库不存在,那就手动创建数据库test
mysql> create database test;
Query OK, 1 row affected (0.01 sec)
mysql> stop slave;
Query OK, 0 rows affected (0.01 sec)
mysql> start slave;
Query OK, 0 rows affected (0.01 sec)
重启slave后,依然报错,再手动创建t1表
mysql> use test;
Database changed
mysql> show tables;
Empty set (0.00 sec)
mysql> CREATE TABLE `t1` (
-> `id` int(11) DEFAULT NULL,
-> `name` varchar(10) DEFAULT NULL
-> ) ENGINE=InnoDB DEFAULT CHARSET=latin1;
Query OK, 0 rows affected (0.03 sec)
再次重启slave
mysql> stop slave;
Query OK, 0 rows affected (0.00 sec)
mysql> start slave;
Query OK, 0 rows affected (0.01 sec)
mysql> show slave status\G;
*************************** 1. row ***************************
Slave_IO_State: Waiting for master to send event
Master_Host: 192.168.25.11
Master_User: test
Master_Port: 3306
Connect_Retry: 60
Master_Log_File: binarylog.000003
Read_Master_Log_Pos: 2647526
Relay_Log_File: mysql-slave-relay-bin.000004
Relay_Log_Pos: 320
Relay_Master_Log_File: binarylog.000003
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: 2647526
Relay_Log_Space: 699
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: cd262711-c528-11ea-9399-000c29a68d4e
Master_Info_File: /data/3307/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:
Executed_Gtid_Set:
Auto_Position: 0
Replicate_Rewrite_DB:
Channel_Name:
Master_TLS_Version:
1 row in set (0.00 sec)
ERROR:
No query specified
一切正常,查看备库表数据
mysql> select * from t1;
+------+-------+
| id | name |
+------+-------+
| 5 | test5 |
+------+-------+
1 row in set (0.01 sec)
表中数据只有id=5的
在主库再次插入一条试试
mysql> insert into t1(id,name) values(6,"test6");
Query OK, 1 row affected (0.01 sec)
从库查看;
mysql> select * from t1;
+------+-------+
| id | name |
+------+-------+
| 5 | test5 |
| 6 | test6 |
+------+-------+
2 rows in set (0.00 sec)
汇总:
做主从复制的时候,一定要获取到之前的binlog和pos才可以,或者导入全库后再开始进行主从复制
【MySQL】Last_SQL_Errno: 1594Relay log read failure: Could not parse relay log event entry...问题总结处理的更多相关文章
- mysql主从同步失败 Relay log read failure: Could not parse relay log event entry
mysql: [Warning] Using a password on the command line interface can be insecure. Welcome to the MySQ ...
- MySQL复制报错(Slave failed to initialize relay log info structure from the repository)
机器重启以后,主从出现了问题,具体报错信息: Slave failed to initialize relay log info structure from the repository 解决方案: ...
- Relay log read failure
root@localhost > show slave status\G*************************** 1. row ************************** ...
- mysql relay log参数汇总
前言:MySQL进行主主复制或主从复制的时候会在配置文件制定的目录下面产生相应的relay log,本文档总结这些相关参数的定义及解释. 1.什么是relay log The relay log, l ...
- ERROR 1872 (HY000): Slave failed to initialize relay log info structure from the repository
salve复制线程停止,尝试start slave 时报ERROR 1872错误mysql> system perror 1872 MySQL error code 1872 (ER_SLAVE ...
- DM 源码阅读系列文章(六)relay log 的实现
2019独角兽企业重金招聘Python工程师标准>>> 作者:张学程 本文为 DM 源码阅读系列文章的第六篇,在 上篇文章 中我们介绍了 binlog replication 处理单 ...
- mysql Last_SQL_Errno: 1197 Coordinator stopped because there were error(s) in the worker(s)问题处理
Last_SQL_Errno: 1197 Coordinator stopped because there were error(s) in the worker(s). The most rece ...
- SSH项目过一段时间之后再访问会报一次Could not open Hibernate session for transaction 异常,Caused by: com.mysql.jdbc.CommunicationsException: Communications link failure due to underlyi,再重新方法即可访问成功(通常出现在过了一晚之后再去访问系统)
前端时间到客户那去进行项目的上线测试,将项目部署好之后,运行都是正常的,可是每到了第二天早上访问的时候,就会报一个Could not open Hibernate session for transa ...
- mysql报错1872: Slave failed to initialize relay log info structure from the repository
ERROR 1872 (HY000): Slave failed to initialize relay log info structure from the repository 在一台主机上增加 ...
随机推荐
- EasyX 简易绘图工具接口整理
EasyX Library for C++ (Ver:20190415(beta)) http://www.easyx.cn EasyX.h 1 #pragma once 2 3 #ifndef ...
- 简单的一段css代码让全站变灰,网站哀悼代码
为表达全国各族人民对抗击新冠肺炎疫情斗争牺牲烈士和逝世通报的深切哀悼,国务院今天发布公告,决定2020年4月4日举行全国性哀悼活动.在此期间,全国和驻外使馆下半旗致哀,全国停止公共娱乐活动,4月4日1 ...
- 自动化管理平台rundeck的安装方法
简介 RunDeck 是用 Java/Grails 写的开源工具,帮助用户在数据中心或者云环境中自动化各种操作和流程.通过命令行或者web界面,用户可以对任意数量的服务器进行操作,大大降低了对服务器自 ...
- 【PY从0到1】第三节 列表
# 3 列表 # 1> 下面这就是一个列表 aabbccdd = ['ee','ff','gg'] # 列表可以储存数据,包含其中元素可以有很多,是可修改.有次序的. # 下面展示一下两套索引. ...
- [日常摸鱼]poj2778 DNA Sequence
这题太神啦 题意:求长度为$n$的不包含给定DNA序列的DNA序列个数,给定的不超过10个 构建出Trie图,用$danger[i]$来表示不能走到$i$,对于DNA序列结尾的结点$danger$设为 ...
- [水题日常]UVA1639 糖果(Candy,ACM/ICPC Chengdu 2012)
今天来尝试了几道数学期望相关的题,这是我认为比较有趣的一道题 这次不废话啦直接开始~ 一句话题意:两个分别装有n个糖果的盒子,每次随机选一个盒子然后拿走一颗糖(选的概率分别是\(p\)和\((1-p) ...
- CTF练习三 —— 命令注入&命令执行绕过
这个题是第四届强网杯也就是2020.8.22号开始的那场一道简单的命令注入题,再这之前我并没有学习过命令注之类的知识,,,看到题之后先搜在学,,误打误撞解了出来,过段时间wp就会放出来,所以这里就不对 ...
- java基础:详解类和对象,类和对象的应用,封装思想,构造方法详解,附练习案列
1. 类和对象 面向对象和面向过程的思想对比 : 面向过程 :是一种以过程为中心的编程思想,实现功能的每一步,都是自己实现的 面向对象 :是一种以对象为中心的编程思想,通过指挥对象实现具体的功能 1. ...
- Python----Flask Web框架(一)
Flask是一个轻量级的基于Python的web框架. 本文适合有一定HTML.Python.网络基础的同学阅读. 1. 简介 这份文档中的代码使用 Python 3 运行.是的,所以读者需要自己在电 ...
- Selenium switch_to方法
在web应用自动化测试中,点击一个链接或者按钮会打开一个新的浏览器窗口,会出现多个窗口实例.默认情况下的焦点在主窗口(父窗口),如果要对子窗口进行操作,就需要首先切换到子窗口. Selenium We ...