MySQL主从同步故障

Slave failed to initialize relay log info structure from the repository

之前做的是数据库主主同步,最近发现数据库A可以从数据库B同步,但数据库B不能从数据库A同步,通过在数据库B执行show slave status可以发现Slave failed to initialize relay log info structure from the repository错误,且Slave_IO_RunningSlave_SQL_Running这两项都是NO。通过重启两台数据库服务,均无法解决。
通过网络搜索,解决办法如下:
在数据库B执行:

stop slave;
reset slave;
change master to master_host='数据库A地址',master_port=3306,master_user='同步账号',master_password='同步账号的密码',master_auto_position =  1;
start slave;

执行后,发现Slave_IO_RunningSlave_SQL_Running这两项都是YES了,但其中的Seconds_Behind_Master是非0值,说明此时数据库B的数据落后于数据库A,表示这两台数据库之间有延时,数字越大,则说明延迟越大。耐心等待该值变为0后,则说明已完成同步。

发表评论

邮箱地址不会被公开。 必填项已用*标注