salve复制线程停止,尝试start slave 时报ERROR 1872错误
mysql> system perror 1872 MySQL error code 1872 (ER_SLAVE_RLI_INIT_REPOSITORY): Slave failed to initialize relay log info structure from the repository
解决过程
1.看样子是找不到中继日志的仓库,但是查看变量relay log的位置是设置了的
mysql> show variables like 'relay%'; +---------------------------+---------------------------------------------------+ | Variable_name | Value | +---------------------------+---------------------------------------------------+ | relay_log | relay-log | | relay_log_basename | /datadir/relay-log | | relay_log_index | /datadir/relay-log.index | | relay_log_info_file | relay-log.info
2.master.infor中也记录日志相关的信息,查看后没有发现异常
3.重置复制信息
mysql> reset master; Query OK, 0 rows affected (0.00 sec) mysql> show slave statusG *************************** 1. row *************************** Slave_IO_State: Master_Host: ******* Master_User: repl Master_Port: 3306 Connect_Retry: 60 Master_Log_File: Read_Master_Log_Pos: 4 Relay_Log_File: relay-log.000001 Relay_Log_Pos: 4
注意: 依然有复制信息
之后接着
set global gtid_purged='*******';
change master to ......;
start slave时依旧报错
4.MySQL DOC关于start slave的描述:
RESET SLAVE does not change any replication connection parameters such as master host, master port, master user, or master password, which are retained in memory. This means that START SLAVE can be issued without requiring a CHANGE MASTER TO statement following RESET SLAVE.
Connection parameters are reset by RESET SLAVE ALL.
5.使用reset slave all清空所有的复制信息,然后重置gtid_purged和master.infor
start slave后复制正常