ERROR 1872 (HY000): Slave failed to initialize relay log info structure from the repository

   該問題的通常是由relay log沒有在配置文件定義所致。
mysql

一、問題描述:sql

mysql> start slave;ide

ERROR 1872 (HY000): Slave failed to initialize relay log info structure from the repositorycode

mysql> system perror 1872it

MySQL error code 1872 (ER_SLAVE_RLI_INIT_REPOSITORY): Slave failed to initialize relay log info structure from the repositoryevent

二、處理辦法
2.一、修改配置文件ast

   諸如在my.cnf配置文件中添加以下項:
class

relay_log = /opt/mysql/logs/mysql-relay-bin配置

   重啓mysql實例使其生效。
file

2.二、從新鏈接master

mysql> stop slave;

Query OK, 0 rows affected, 1 warning (0.00 sec)


mysql> change master to master_host='192.168.2.10',master_user='repl_user',master_password='123456',master_log_file='mysql-bin.000002',master_log_pos=821301;

Query OK, 0 rows affected, 2 warnings (0.00 sec)


mysql> start slave;

ERROR 1872 (HY000): Slave failed to initialize relay log info structure from the repository

   從新鏈接後問題依舊。

2.三、從新設置slave

mysql> reset slave;

Query OK, 0 rows affected (0.00 sec)


mysql> change master to master_host='192.168.2.10',master_user='repl_user',master_password='123456',master_log_file='mysql-bin.000002',master_log_pos=821301;

Query OK, 0 rows affected, 2 warnings (0.02 sec)


mysql> start slave;

Query OK, 0 rows affected (0.12 sec)

   再次查看slave狀態:

mysql> show slave status\G;

*************************** 1. row ***************************

               Slave_IO_State: Waiting for master to send event

                  Master_Host: 192.168.2.10

                  Master_User: repl_user

                  Master_Port: 3306

                Connect_Retry: 60

              Master_Log_File: mysql-bin.000002

          Read_Master_Log_Pos: 824989

               Relay_Log_File: mysql-relay-bin.000002

                Relay_Log_Pos: 3971

        Relay_Master_Log_File: mysql-bin.000002

             Slave_IO_Running: Yes

            Slave_SQL_Running: Yes

.......

    問題解決。

相關文章
相關標籤/搜索