首页 > 数据库 >MySQL 主从报错“Got fatal error 1236 from master when reading data from binary log: 'Could not find

MySQL 主从报错“Got fatal error 1236 from master when reading data from binary log: 'Could not find

时间:2024-07-07 10:19:08浏览次数:16  
标签:binary Last Log Replicate SSL Master mysql 报错 log

1、背景

一主一从报错,测试环境

从库执行show slave status\G

mysql> show slave status\G
*************************** 1. row ***************************
               Slave_IO_State: 
                  Master_Host: 10.0.0.51
                  Master_User: repl
                  Master_Port: 3306
                Connect_Retry: 10
              Master_Log_File: mysql-bin.000027
          Read_Master_Log_Pos: 197
               Relay_Log_File: db02-relay-bin.000059
                Relay_Log_Pos: 366
        Relay_Master_Log_File: mysql-bin.000027
             Slave_IO_Running: No
            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: 197
              Relay_Log_Space: 980
              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: 13114
                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: 53
                  Master_UUID: c261769d-e2ac-11ed-93ef-000c29ee4d81
             Master_Info_File: mysql.slave_master_info
                    SQL_Delay: 0
          SQL_Remaining_Delay: NULL
      Slave_SQL_Running_State: Replica has read all relay log; waiting for more updates
           Master_Retry_Count: 86400
                  Master_Bind: 
      Last_IO_Error_Timestamp: 240707 09:44:35
     Last_SQL_Error_Timestamp: 
               Master_SSL_Crl: 
           Master_SSL_Crlpath: 
           Retrieved_Gtid_Set: c261769d-e2ac-11ed-93ef-000c29ee4d81:18-23
            Executed_Gtid_Set: 13d3c89a-e2ad-11ed-8b66-000c29ea33e0:1-156,
c261769d-e2ac-11ed-93ef-000c29ee4d81:18-23
                Auto_Position: 0
         Replicate_Rewrite_DB: 
                 Channel_Name: 
           Master_TLS_Version: 
       Master_public_key_path: 
        Get_master_public_key: 0
            Network_Namespace: 
1 row in set, 1 warning (0.00 sec)

 

2、从报错信息可以看出是从库没有找到第一个log,可能是主库清理过Log导致。

解决方法:

方法一:直接推掉从库从重新搭建一个从库

方法二:跳过

3、介绍方法二

先停止主从复制关系(从库执行)

stop slave;

主库执行

mysql> SHOW MASTER STATUS\g
+------------------+----------+--------------+------------------+-------------------------------------------+
| File             | Position | Binlog_Do_DB | Binlog_Ignore_DB | Executed_Gtid_Set                         |
+------------------+----------+--------------+------------------+-------------------------------------------+
| mysql-bin.000036 |      197 |              |                  | c261769d-e2ac-11ed-93ef-000c29ee4d81:1-34 |
+------------------+----------+--------------+------------------+-------------------------------------------+
1 row in set (0.00 sec)

mysql> flush logs;
Query OK, 0 rows affected (0.03 sec)

mysql> SHOW MASTER STATUS\g
+------------------+----------+--------------+------------------+-------------------------------------------+
| File             | Position | Binlog_Do_DB | Binlog_Ignore_DB | Executed_Gtid_Set                         |
+------------------+----------+--------------+------------------+-------------------------------------------+
| mysql-bin.000037 |      197 |              |                  | c261769d-e2ac-11ed-93ef-000c29ee4d81:1-34 |
+------------------+----------+--------------+------------------+-------------------------------------------+
1 row in set (0.00 sec)

从库执行

mysql> change master to master_log_file='mysql-bin.000037',master_log_pos=197;
Query OK, 0 rows affected, 3 warnings (0.02 sec)

mysql> 
mysql> 
mysql> start slave;
Query OK, 0 rows affected, 1 warning (0.01 sec)

mysql> 
mysql> 
mysql> 
mysql> 
mysql> show slave status\G
*************************** 1. row ***************************
               Slave_IO_State: Waiting for source to send event
                  Master_Host: 10.0.0.51
                  Master_User: repl
                  Master_Port: 3306
                Connect_Retry: 10
              Master_Log_File: mysql-bin.000037
          Read_Master_Log_Pos: 197
               Relay_Log_File: db02-relay-bin.000002
                Relay_Log_Pos: 326
        Relay_Master_Log_File: mysql-bin.000037
             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: 197
              Relay_Log_Space: 535
              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: 53
                  Master_UUID: c261769d-e2ac-11ed-93ef-000c29ee4d81
             Master_Info_File: mysql.slave_master_info
                    SQL_Delay: 0
          SQL_Remaining_Delay: NULL
      Slave_SQL_Running_State: Replica 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: 13d3c89a-e2ad-11ed-8b66-000c29ea33e0:1-156,
c261769d-e2ac-11ed-93ef-000c29ee4d81:18-23
                Auto_Position: 0
         Replicate_Rewrite_DB: 
                 Channel_Name: 
           Master_TLS_Version: 
       Master_public_key_path: 
        Get_master_public_key: 0
            Network_Namespace: 
1 row in set, 1 warning (0.01 sec)

主库再次查看主从复制

mysql> show master status\G
*************************** 1. row ***************************
             File: mysql-bin.000037
         Position: 483
     Binlog_Do_DB: 
 Binlog_Ignore_DB: 
Executed_Gtid_Set: c261769d-e2ac-11ed-93ef-000c29ee4d81:1-35
1 row in set (0.00 sec)

 

 

 

 

 

 

标签:binary,Last,Log,Replicate,SSL,Master,mysql,报错,log
From: https://www.cnblogs.com/linuxmysql/p/18288251

相关文章

  • python3.7报错ModuleNotFoundError: No module named 'importlib.metadata'
    1.问题今天在使用一个项目的时候遇到以下的问题:ModuleNotFoundError:Nomodulenamed'importlib.metadata'个人的情况:python3.7conda环境中安装了importlib-meta的工具包,版本为6.7.0在引入的过程中,还是出现了问题。这是由于,包的引入方式和包名不一致引起的。具体如下......
  • 解决Pycharm配置R语言环境报错RWrapper terminated, exitcode: 127
    问题解决Pycharm配置R语言环境报错RWrapperterminated,exitcode:127errorwhileloadingsharedlibraries:libR.so:site:stackoverflow.com解决方案1.打开GetEnvVars.R文件打开C:\Users\UserName\AppData\Roaming\JetBrains\PyCharm版本号\plugins\r-plugin\R\目录......
  • MIT6.824-2022 分布式系统课程实验笔记 Lab 2B Raft-日志复制(Log Replication)--xunznu
    Part2B:LogReplication日志复制(困难)文章目录Part2B:LogReplication日志复制(困难)Lab1:MapReduceLab2:Raft实验解读Lab2A:领导者选举leaderelection我的代码实现(附带详细代码注释)提示:实现细节:1、commitIndex和lastApplied2、nextIndex和matchIndex3、Co......
  • MinGW GCC 编译Glog0.6.0
     GCC版本: gccversion5.3.0(i686-posix-dwarf-rev0,BuiltbyMinGW-W64project)glog0.6.0地址: https://github.com/google/glog/tree/v0.6.0 编译很顺利,直接 然后进入C:/tmp/glog-0.6.0/Build2目录,执行命令: 编译完成后,在目录下存在libglog.dll和libglog.dll.a......
  • nuxt3启动报错The requested module 'file://C:/Users/acer/node_modules/ufo/dist/in
    背景进行某些配置后,启动nuxt3的测试服务器报错。解决下面这个目录并不是npm的全局目录C:/Users/acer/node_modules我的解决办法是直接使用npm或者cnpm全局安装ufo这个包,然后把这个包移到该位置。#npm全局安装路径C:\Users\%USERNAME%\AppData\Roaming\npm\node_modules......
  • centos7服务器yum安装MySQL数据库,以及报错的解决方案
    文章目录1、数据库能做什么?2、数据库由来3、数据库-系统结构4、版本二、部署1、官网地址3.点击[DOCUMENTATION](https://dev.mysql.com/doc/)4.mysql的yum仓库[UsingtheMySQLYumRepository](https://dev.mysql.com/doc/refman/8.4/en/linux-installation-yum-repo......
  • appium自动化测试报错:Unable to launch com.facebook.WebDriverAgentRunner.maukkaki.
    嗨,我是兰若,今天在编写自动化测试用例的时候,appiuminspector报错:Unabletolaunchcom.facebook.WebDriverAgentRunner.maukkaki.xctrunner1、当时首先想到的就是检查WebDriverAgent的构建和安装是否正常,后来发现这块的安装是完全按照官方文档进行的,并且彼时我的手机上已经......
  • uniapp报错 TypeError: Cannot read properties of undefined (reading ‘replace‘)
      欢迎关注我......
  • 题解:CF1256D Binary String Minimizing
    贪心。数据范围\(n\le10^{6}\),因此我们要用时间复杂度为\(\mathcal{O}\left(n\right)\)的算法来解决这个问题。思路从左至右扫一遍序列,如果遇到\(10\),则要将这个\(0\)交换到前面的位置。由于是字典序最小,\(0\)应该尽量在最高位。现在需要知道这个\(0\)被交换到哪......
  • string str = “中文lin”不会报错,但为什么还必须使用wstring wstr
    在C++中,字符串字面量"中文lin"默认是窄字符字符串(char类型),而不是宽字符字符串(wchar_t类型)。当你尝试将这个字符串字面量赋值给一个std::string对象时,通常不会直接报错,但前提是源文件(.cpp文件)的编码支持这些字符。如果你的源文件是以UTF-8编码保存的,并且你的编译器(......