重启了一下从库,忘记先stop slave ,直接mysqladmin shutdown关闭实例,结果起不来了
mysql> start slave;
ERROR 1872 (HY000): Slave failed to initialize relay log info structure from the repository
这个错误就是relay log有问题,但我看自己的配置中有配置relay_log参数,但为什么从库启动会在此处出问题呢
重新开启同步,先记下当前从库同步的位置
mysql> show slave statusG; *************************** 1. row *************************** Slave_IO_State: Master_Host: 10.*.*.* Master_User: db_slave Master_Port: 3301 Connect_Retry: 60 Master_Log_File: mysql-bin.013463 Read_Master_Log_Pos: 247058609
reset master;
reset slave all;
mysql> CHANGE MASTER TO
-> MASTER_HOST='10.***',
-> MASTER_USER='db_slave',
-> MASTER_PASSWORD='***********',
-> MASTER_PORT=3301,
-> MASTER_LOG_FILE='mysql-bin.013463',
-> MASTER_LOG_POS=247058609,
-> MASTER_CONNECT_RETRY=10;
ERROR 29 (HY000): File '/data/mysql_3301/var/mysql-relay-bin.000001' not found (Errcode: 2 - No such file or directory)
结果还是报错,还是关于relay log的,然后
修改配置文件,新建一个目录,重新为relay log指定一个目录,不再使用原来的目录
relay_log = /data/mysql_3301/log/mysql-relay-bin
再次CHANGE MASTER TO……,start slave,这次从库成功启动了