• MySQL主从报错1872 Slave failed to initialize relay log info structure from the repository【原创】


    一台MySQL服务器重启后发现主从复制报错

    Last_Errno: 1872
    Last_Error: Slave failed to initialize relay log info structure from the repository
     
    mysql> show slave statusG;
    *************************** 1. row ***************************
                   Slave_IO_State: 
                      Master_Host: X.X.X.X
                      Master_User: repl
                      Master_Port: 3306
                    Connect_Retry: 60
                  Master_Log_File: mysql-bin.000076
              Read_Master_Log_Pos: 828924371
                   Relay_Log_File: localhost-relay-bin.000188
                    Relay_Log_Pos: 720496744
            Relay_Master_Log_File: mysql-bin.000076
                 Slave_IO_Running: No
                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: 1872
                       Last_Error: Slave failed to initialize relay log info structure from the repository
                     Skip_Counter: 0
              Exec_Master_Log_Pos: 828924371
                  Relay_Log_Space: 0
                  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: 1872
                   Last_SQL_Error: Slave failed to initialize relay log info structure from the repository
      Replicate_Ignore_Server_Ids: 
                 Master_Server_Id: 0
                      Master_UUID: 54481e1e-99ad-11e5-8540-000af78d3c6c
                 Master_Info_File: /home/mysql/mysql-data/mysql/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: 210907 15:32:42
                   Master_SSL_Crl: 
               Master_SSL_Crlpath: 
               Retrieved_Gtid_Set: 
                Executed_Gtid_Set: 
                    Auto_Position: 0
             Replicate_Rewrite_DB: 
                     Channel_Name: 
    1 row in set (0.00 sec)
    
    ERROR: 
    No query specified

     应该是服务器的主机名改过,relay-log也没有命名写在配置文件中。所以造成无法找到中继日志。

    如果不命名会以主机名命名relay-log即

    主机名-relay-bin.000001

    解决办法:

    可以在my.cnf指定中继日志名字,然后重启一下MySQL服务即可。

    # cat /etc/my.cnf |grep relay
    relay-log=db1-relay-bin

     欢迎转载,请注明出处!

  • 相关阅读:
    Rancher安装
    JDK8日期时间对象
    String经典面试题
    String
    单例模式
    多线程
    接口
    代码块
    内存吞金兽(Elasticsearch)的那些事儿 -- 常见问题痛点及解决方案
    内存吞金兽(Elasticsearch)的那些事儿 -- 写入&检索原理
  • 原文地址:https://www.cnblogs.com/paul8339/p/15239008.html
Copyright © 2020-2023  润新知