不带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

相关文章

JavaScript中的reduce方法执行过程、使用场景及进阶用法

《JavaScript中的reduce方法执行过程、使用场景及进阶用法》:本文主要介绍JavaScript中的reduce方法执行过程、使用场景及进阶用法的相关资料,reduce是JavaScri... 目录1. 什么是reduce2. reduce语法2.1 语法2.2 参数说明3. reduce执行过程

在MySQL执行UPDATE语句时遇到的错误1175的解决方案

《在MySQL执行UPDATE语句时遇到的错误1175的解决方案》MySQL安全更新模式(SafeUpdateMode)限制了UPDATE和DELETE操作,要求使用WHERE子句时必须基于主键或索引... mysql 中遇到的 Error Code: 1175 是由于启用了 安全更新模式(Safe Upd

解决JavaWeb-file.isDirectory()遇到的坑问题

《解决JavaWeb-file.isDirectory()遇到的坑问题》JavaWeb开发中,使用`file.isDirectory()`判断路径是否为文件夹时,需要特别注意:该方法只能判断已存在的文... 目录Jahttp://www.chinasem.cnvaWeb-file.isDirectory()遇

Java通过反射获取方法参数名的方式小结

《Java通过反射获取方法参数名的方式小结》这篇文章主要为大家详细介绍了Java如何通过反射获取方法参数名的方式,文中的示例代码讲解详细,感兴趣的小伙伴可以跟随小编一起学习一下... 目录1、前言2、解决方式方式2.1: 添加编译参数配置 -parameters方式2.2: 使用Spring的内部工具类 -

Spring Boot 整合 ShedLock 处理定时任务重复执行的问题小结

《SpringBoot整合ShedLock处理定时任务重复执行的问题小结》ShedLock是解决分布式系统中定时任务重复执行问题的Java库,通过在数据库中加锁,确保只有一个节点在指定时间执行... 目录前言什么是 ShedLock?ShedLock 的工作原理:定时任务重复执行China编程的问题使用 Shed

Spring Boot统一异常拦截实践指南(最新推荐)

《SpringBoot统一异常拦截实践指南(最新推荐)》本文介绍了SpringBoot中统一异常处理的重要性及实现方案,包括使用`@ControllerAdvice`和`@ExceptionHand... 目录Spring Boot统一异常拦截实践指南一、为什么需要统一异常处理二、核心实现方案1. 基础组件

详解如何在React中执行条件渲染

《详解如何在React中执行条件渲染》在现代Web开发中,React作为一种流行的JavaScript库,为开发者提供了一种高效构建用户界面的方式,条件渲染是React中的一个关键概念,本文将深入探讨... 目录引言什么是条件渲染?基础示例使用逻辑与运算符(&&)使用条件语句列表中的条件渲染总结引言在现代

Python调用另一个py文件并传递参数常见的方法及其应用场景

《Python调用另一个py文件并传递参数常见的方法及其应用场景》:本文主要介绍在Python中调用另一个py文件并传递参数的几种常见方法,包括使用import语句、exec函数、subproce... 目录前言1. 使用import语句1.1 基本用法1.2 导入特定函数1.3 处理文件路径2. 使用ex

MySQL中时区参数time_zone解读

《MySQL中时区参数time_zone解读》MySQL时区参数time_zone用于控制系统函数和字段的DEFAULTCURRENT_TIMESTAMP属性,修改时区可能会影响timestamp类型... 目录前言1.时区参数影响2.如何设置3.字段类型选择总结前言mysql 时区参数 time_zon

Linux使用dd命令来复制和转换数据的操作方法

《Linux使用dd命令来复制和转换数据的操作方法》Linux中的dd命令是一个功能强大的数据复制和转换实用程序,它以较低级别运行,通常用于创建可启动的USB驱动器、克隆磁盘和生成随机数据等任务,本文... 目录简介功能和能力语法常用选项示例用法基础用法创建可启动www.chinasem.cn的 USB 驱动