本文共 1145 字,大约阅读时间需要 3 分钟。
主服务器异外重启导致从服务器出现同步问题,以下是详细的解决过程:
主服务器重启后,从服务器出现以下错误:
show slave status错误:Slave_IO_Running: NoSlave_SQL_Running: Yes
错误日志显示:
Got fatal error 1236 from master when reading data from binary log: 'Client requested master to start replication from impossible position'
同时,查看mysql错误日志:
Error reading packet from server: Client requested master to start replication from impossible position ( server_errno=1236)
初步排查
stop slave;
change master to master_log_file='mysql-bin.000288',master_log_pos=627625751;
start slave;
主服务器日志分析
mysqlbinlog /data/mysql/binlog/mysql-bin.000288 > test.txt
627655136
,但未找到对应的位置。确定最接近的位置
627655136
的位置:# at 627625495#111010 16:35:46 server id 1 end_log_pos 627625631
627625631
,并将其作为新的主从位置。调整从服务器配置
stop slave;
change master to master_log_file='mysql-bin.000288',master_log_pos=627625631;
start slave;
Slave_IO_State: Queueing master event to the relay logSlave_SQL_Running: Yes
通过上述步骤,成功解决了主从服务器的同步问题。对于其他从服务器,可采用相同方法进行修复。
转载地址:http://rtbfk.baihongyu.com/