'Could not find first log file name in binary log index file'

本文涉及的产品
云数据库 RDS MySQL,集群版 2核4GB 100GB
推荐场景:
搭建个人博客
RDS MySQL Serverless 基础系列,0.5-2RCU 50GB
日志服务 SLS,月写入数据量 50GB 1个月
简介:

mysql> show slave status\G;
*************************** 1. row ***************************
               Slave_IO_State:
                  Master_Host: 192.168.25.57
                  Master_User: repl
                  Master_Port: 3306
                Connect_Retry: 60
              Master_Log_File: mysqld-bin.000014
          Read_Master_Log_Pos: 107
               Relay_Log_File: mysql-relay-bin.000001
                Relay_Log_Pos: 4
        Relay_Master_Log_File: mysqld-bin.000014
             Slave_IO_Running: No
            Slave_SQL_Running: YES

              Replicate_Do_DB: discuz
          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: 107
              Relay_Log_Space: 107
              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: 1236
                Last_IO_Error: Got fatal error 1236 from master when reading data from binary log: 'Could not find first log file name in binary log index file'
               Last_SQL_Errno: 0
               Last_SQL_Error:
  Replicate_Ignore_Server_Ids:
             Master_Server_Id: 1
1 row in set (0.00 sec)

ERROR:
No query specified

解决办法:
从机器停止slave
mysql> slave stop;
到master机器登陆mysql:
记录master的bin的位置,例如:mysql> show mster status;

+------------------+----------+--------------+------------------+
| File             | Position | Binlog_Do_DB | Binlog_Ignore_DB |
+------------------+----------+--------------+------------------+
| mysql-bin.000013 |      107 | discuz       |                  |
+------------------+----------+--------------+------------------+
1 row in set (0.00 sec)

日志为mysqld-bin.000013
刷新日志:mysql> flush logs;
因为刷新日志file的位置会+1,即File变成为:mysqld-bin.000014
马上到slave server执行
mysql> CHANGE MASTER TO MASTER_LOG_FILE='mysqld-bin.000014',MASTER_LOG_POS=107;
mysql> slave start;
mysql> show slave status\G;
主从恢复正常

注:CHANGE MASTER TO MASTER_LOG_FILE='mysqld-bin.000014',MASTER_LOG_POS=107;语句千万注意单引号前面不能有空格,否则也会主从同步失败,关闭selinux和iptables允许master、slave伺服器的ip访问.


本文转自 boy461205160 51CTO博客,原文链接:http://blog.51cto.com/461205160/1737725


相关实践学习
日志服务之数据清洗与入湖
本教程介绍如何使用日志服务接入NGINX模拟数据,通过数据加工对数据进行清洗并归档至OSS中进行存储。
相关文章
|
2月前
|
SQL 关系型数据库 MySQL
MySQL数据库,可以使用二进制日志(binary log)进行时间点恢复
对于MySQL数据库,可以使用二进制日志(binary log)进行时间点恢复。二进制日志是MySQL中记录所有数据库更改操作的日志文件。要进行时间点恢复,您需要执行以下步骤: 1. 确保MySQL配置文件中启用了二进制日志功能。在配置文件(通常是my.cnf或my.ini)中找到以下行,并确保没有被注释掉: Copy code log_bin = /path/to/binary/log/file 2. 在需要进行恢复的时间点之前创建一个数据库备份。这将作为恢复的基准。 3. 找到您要恢复到的时间点的二进制日志文件和位置。可以通过执行以下命令来查看当前的二进制日志文件和位
169 1
|
18天前
|
SQL 运维 关系型数据库
|
2月前
|
存储 关系型数据库 数据库
关系型数据库文件方式存储LOG FILE(日志文件)
【5月更文挑战第11天】关系型数据库文件方式存储LOG FILE(日志文件)
136 1
|
8月前
|
消息中间件
failed to open log file at ‘/var/log/rabbitmq/rabbit@9f987b50c687_upgrade.log‘, reason: permission d
failed to open log file at ‘/var/log/rabbitmq/rabbit@9f987b50c687_upgrade.log‘, reason: permission d
204 0
|
Oracle 前端开发 关系型数据库
log file sync 和 log file parallel write等待事件的区别和联系
log file parallel write 和log file sync这两个等待事件关系密切,很多人对这两个等待事件有一些误解,我们先来看看Oracle官方文档的解释:
|
监控 iOS开发 MacOS
iOS 友盟崩溃日志分析——Binary images
iOS 友盟崩溃日志分析——Binary images
240 0
|
Java Android开发
Eclipse打不开,出现an error has occured see the log file(日志中出现!MESSAGE FrameworkEvent ERROR !STACK 0)问题
Eclipse打不开,出现an error has occured see the log file(日志中出现!MESSAGE FrameworkEvent ERROR !STACK 0)问题
714 0
Eclipse打不开,出现an error has occured see the log file(日志中出现!MESSAGE FrameworkEvent ERROR !STACK 0)问题
|
SQL
MySQL:简单记录删除binary log的接口和O_DIRECT不会用到REDO
一、栈帧 #0 my_delete (name=0x7ffff0fa0490 "./binlog.000005", MyFlags=0) at /root/softm/percona-server-5.
884 0
|
关系型数据库 MySQL 数据库
MySQL binary log 配置及使用简介
mysql binlog相关内容,MySQL5.7.25,ubuntu 16.04
3044 0