【昊鼎王五】mysql启动slave时报1872错误,初始化relay log结构失败了,为什么会失败呢,根源是什么?

【昊鼎王五】mysql启动slave时报1872错误,初始化relay log结构失败了,为什么会失败呢,根源是什么?

前言:

在上一篇文章里面讲了如何解决“Slave failed to initialize relay log info structure from the repository, Error_code: 1872”
网址请见:https://blog.csdn.net/haoding205/article/details/102599340

一.现象:

dba:(none)> start slave;
ERROR 1872 (HY000): Slave failed to initialize relay log info structure from the repository

解决方法请见:https://blog.csdn.net/haoding205/article/details/102599340

二.分析:

MySQL [(none)]> show slave status\G
*************************** 1. row ***************************
               Slave_IO_State:  
                  Master_Host: 192.168.1.11
                  Master_User: fuzhi
                  Master_Port: 3306
                Connect_Retry: 60
              Master_Log_File: mysql-bin.000007
          Read_Master_Log_Pos: 1015219027
               Relay_Log_File: centos-relay-bin.000013
                Relay_Log_Pos: 1015219240
        Relay_Master_Log_File: mysql-bin.000007
             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: 1015219027
              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: 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: 1                  
1 row in set (0.00 sec)

启动slave时,使用repository中信息初始化relay log结构失败了。为什么失败了?
是因为上述的某些参数中,一定是有某些不匹配,找不到最新的信息导致错误了。

三.根源:

和当初搭建MYSQL的运维人员沟通排查,发现机器原来的名称是centos,
而此刻机器的名称叫做“mysql-2-cn”,所以重启MYSQL进程之后,系统生成的Relay_Log_File就以当前机器名字来命名,比如叫“mysql-2-cn-relay-bin.000002”,
而mysql.slave_relay_log_info表中保留了以前的复制信息,记录的Relay_Log_File是centos-relay-bin.000013
前后信息不匹配,导致启动失败,报错。

四.总结:

所以,一句话概括:
不要随便修改机器名称,就跟人名一样,改名请慎重。
改名会影响到MYSQL的主从配置,改了名就需要重新配置MYSQL的主从,否则就轻易不要“改名”。

好了,聪明如你,就讲到这里吧,有问题的话可以留言。
在这里插入图片描述

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值