不带MASTER_LOG_FILE,MASTER_LOG_POS参数,执行change master 语句复制异常

2024-05-04 01:38

本文主要是介绍不带MASTER_LOG_FILE,MASTER_LOG_POS参数,执行change master 语句复制异常,希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!

-------------分析日志-------------
1.先停止复制进程:
dbadmin@(none) 08:05:45>stop slave;
Query OK, 0 rows affected (0.10 sec)

2.查看丛库的状态及复制点坐标:
dbadmin@(none) 08:05:52>show slave status \G
*************************** 1. row ***************************
               Slave_IO_State:
                  Master_Host: Master_Host
                  Master_User: Master_User
                  Master_Port: 3306
                Connect_Retry: 60
              Master_Log_File: mysql-bin.004476
          Read_Master_Log_Pos: 289617713
               Relay_Log_File: mysqld-relay-bin.000067
                Relay_Log_Pos: 289617859
        Relay_Master_Log_File: mysql-bin.004476
             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: 0
                   Last_Error:
                 Skip_Counter: 0
          Exec_Master_Log_Pos: 289617713
              Relay_Log_Space: 289618059
              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: 0
               Last_SQL_Error:
  Replicate_Ignore_Server_Ids:
             Master_Server_Id: 612
1 row in set (0.00 sec)

3.查看一下master.info与relay-log.info文件中的信息,此时文件中记录的信息与show slave status显示的信息一致。
dbadmin@(none) 08:05:55>system cat /vobiledata/mysqldata/master.info;
18
mysql-bin.004476
289617713
Master_Host
repl
pass
3306
60
0





0
0.000

0
dbadmin@(none) 08:07:52>system cat /vobiledata/mysqldata/relay-log.info;
./mysqld-relay-bin.000067
289617859
mysql-bin.004476
289617713

4.不带MASTER_LOG_FILE,MASTER_LOG_POS参数,执行change master 语句,按照mysql官方文档的说法,执行语句后的复制点应该与之前的复制点一致,然而事实并非如此,执行该语句后,复制点被清空,记录在master.info和relay-log.info文件中的关于复制点的信息也被清空,如下:
dbadmin@(none) 08:08:24>CHANGE MASTER TO MASTER_HOST='Master_Host', MASTER_USER='repl', MASTER_PASSWORD='pass';
Query OK, 0 rows affected (0.11 sec)

dbadmin@(none) 08:08:55>show slave status \G
*************************** 1. row ***************************
               Slave_IO_State:
                  Master_Host: Master_Host
                  Master_User: Master_User
                  Master_Port: 3306
                Connect_Retry: 60
              Master_Log_File:
          Read_Master_Log_Pos: 4
               Relay_Log_File: mysqld-relay-bin.000001
                Relay_Log_Pos: 4
        Relay_Master_Log_File:
             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: 0
                   Last_Error:
                 Skip_Counter: 0
          Exec_Master_Log_Pos: 0
              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: 0
                Last_IO_Error:
               Last_SQL_Errno: 0
               Last_SQL_Error:
  Replicate_Ignore_Server_Ids:
             Master_Server_Id: 612
1 row in set (0.00 sec)


dbadmin@(none) 08:09:01>system cat /vobiledata/mysqldata/master.info;
18

4
Master_Host
repl
pass
3306
60
0





0
1800.000

0
60
0





0
0.000

0
dbadmin@(none) 08:09:17>system cat /vobiledata/mysqldata/relay-log.info;
./mysqld-relay-bin.000001
4

0
7859
mysql-bin.004476
289617713

重启复制进程,发现复制点被莫名奇妙的变成了另外一个值,这个值既不是执行语句前的复制点,也不是执行语句后的复制点。
dbadmin@(none) 08:09:26>start slave;
Query OK, 0 rows affected (0.00 sec)

dbadmin@(none) 08:09:47>show slave status \G
*************************** 1. row ***************************
               Slave_IO_State: Waiting for master to send event
                  Master_Host: Master_Host
                  Master_User: Master_User
                  Master_Port: 3306
                Connect_Retry: 60
              Master_Log_File: mysql-bin.004430
          Read_Master_Log_Pos: 9547576
               Relay_Log_File: mysqld-relay-bin.000003
                Relay_Log_Pos: 360
        Relay_Master_Log_File: mysql-bin.004429
             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: 214
              Relay_Log_Space: 53239
              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: 436462
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: 612
1 row in set (0.00 sec)

dbadmin@(none) 08:09:52>show slave status \G
*************************** 1. row ***************************
               Slave_IO_State: Waiting for master to send event
                  Master_Host: Master_Host
                  Master_User: Master_User
                  Master_Port: 3306
                Connect_Retry: 60
              Master_Log_File: mysql-bin.004430
          Read_Master_Log_Pos: 61188972
               Relay_Log_File: mysqld-relay-bin.000003
                Relay_Log_Pos: 360
        Relay_Master_Log_File: mysql-bin.004429
             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: 214
              Relay_Log_Space: 53239
              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: 436482
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: 612
1 row in set (0.00 sec)

赶紧停止复制,发现命令居然被长时间卡住,尝试停止mysql服务,超时异常,最后通过kill 系统进程,并重启mysql服务,重新设为正确的复制点。
dbadmin@(none) 08:10:12>stop slave;

查看error log,发现有如下日志:
160510  8:08:55 [Note] 'CHANGE MASTER TO executed'. Previous state master_host='192.168.110.113', master_port='3306', master_log_file='mysql-bin.004476', master_log_pos='289617713'. New state master_host='192.168.110.113', master_port='3306', master_log_file='', master_log_pos='4'.
160510  8:09:47 [Note] Slave SQL thread initialized, starting replication in log 'FIRST' at position 0, relay log './mysqld-relay-bin.000001' position: 4
160510  8:09:47 [Note] Slave I/O thread: connected to master 'repl@192.168.110.113:3306',replication started in log 'FIRST' at position 4

这篇关于不带MASTER_LOG_FILE,MASTER_LOG_POS参数,执行change master 语句复制异常的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!



http://www.chinasem.cn/article/958084

相关文章

Spring Boot项目部署命令java -jar的各种参数及作用详解

《SpringBoot项目部署命令java-jar的各种参数及作用详解》:本文主要介绍SpringBoot项目部署命令java-jar的各种参数及作用的相关资料,包括设置内存大小、垃圾回收... 目录前言一、基础命令结构二、常见的 Java 命令参数1. 设置内存大小2. 配置垃圾回收器3. 配置线程栈大小

Java Optional避免空指针异常的实现

《JavaOptional避免空指针异常的实现》空指针异常一直是困扰开发者的常见问题之一,本文主要介绍了JavaOptional避免空指针异常的实现,帮助开发者编写更健壮、可读性更高的代码,减少因... 目录一、Optional 概述二、Optional 的创建三、Optional 的常用方法四、Optio

SpringBoot利用@Validated注解优雅实现参数校验

《SpringBoot利用@Validated注解优雅实现参数校验》在开发Web应用时,用户输入的合法性校验是保障系统稳定性的基础,​SpringBoot的@Validated注解提供了一种更优雅的解... 目录​一、为什么需要参数校验二、Validated 的核心用法​1. 基础校验2. php分组校验3

CSS will-change 属性示例详解

《CSSwill-change属性示例详解》will-change是一个CSS属性,用于告诉浏览器某个元素在未来可能会发生哪些变化,本文给大家介绍CSSwill-change属性详解,感... will-change 是一个 css 属性,用于告诉浏览器某个元素在未来可能会发生哪些变化。这可以帮助浏览器优化

在java中如何将inputStream对象转换为File对象(不生成本地文件)

《在java中如何将inputStream对象转换为File对象(不生成本地文件)》:本文主要介绍在java中如何将inputStream对象转换为File对象(不生成本地文件),具有很好的参考价... 目录需求说明问题解决总结需求说明在后端中通过POI生成Excel文件流,将输出流(outputStre

golang 日志log与logrus示例详解

《golang日志log与logrus示例详解》log是Go语言标准库中一个简单的日志库,本文给大家介绍golang日志log与logrus示例详解,感兴趣的朋友一起看看吧... 目录一、Go 标准库 log 详解1. 功能特点2. 常用函数3. 示例代码4. 优势和局限二、第三方库 logrus 详解1.

MySQL INSERT语句实现当记录不存在时插入的几种方法

《MySQLINSERT语句实现当记录不存在时插入的几种方法》MySQL的INSERT语句是用于向数据库表中插入新记录的关键命令,下面:本文主要介绍MySQLINSERT语句实现当记录不存在时... 目录使用 INSERT IGNORE使用 ON DUPLICATE KEY UPDATE使用 REPLACE

Java异常架构Exception(异常)详解

《Java异常架构Exception(异常)详解》:本文主要介绍Java异常架构Exception(异常),具有很好的参考价值,希望对大家有所帮助,如有错误或未考虑完全的地方,望不吝赐教... 目录1. Exception 类的概述Exception的分类2. 受检异常(Checked Exception)

Spring定时任务只执行一次的原因分析与解决方案

《Spring定时任务只执行一次的原因分析与解决方案》在使用Spring的@Scheduled定时任务时,你是否遇到过任务只执行一次,后续不再触发的情况?这种情况可能由多种原因导致,如未启用调度、线程... 目录1. 问题背景2. Spring定时任务的基本用法3. 为什么定时任务只执行一次?3.1 未启用

Java报NoClassDefFoundError异常的原因及解决

《Java报NoClassDefFoundError异常的原因及解决》在Java开发过程中,java.lang.NoClassDefFoundError是一个令人头疼的运行时错误,本文将深入探讨这一问... 目录一、问题分析二、报错原因三、解决思路四、常见场景及原因五、深入解决思路六、预http://www