Today, a few MySQL servers suddenly power outages, restart after the replication can not start, always reported the following error:
080922 10:29:01 [note] Slave SQL thread initialized, starting replication into log ' mysql-bin.000778 ' at position 2874108, R Elay log './relay-bin.003287 ' position:2874245
080922 10:29:01 [note] Slave I/O thread:connected to master ' replication@192.168.0.10:3306 ', replication started in log ' Mysql-b in.000778 ' at position 2874108
080922 10:29:01 [ERROR] Error reading packet from Server:client requested master to start replication from impossible Pos Ition (SE rver_errno=1236)
080922 10:29:01 [ERROR] Got fatal ERROR 1236: ' Client requested Master to start replication from impossible ' Master WH en reading data from binary log
Why would you report impossible position? Open the mysql-bin.000778 and see.
Mysqlbinlog mysql-bin.000778 > Log.sql
Tail-f Log.sql
# at 2871574 #080922 10:20:27 server ID 2 end_log_pos 2871601 Xid = 2516638
commit/*!*/;
DELIMITER;
# End of log file
ROLLBACK/* Added by Mysqlbinlog * *;
/*!50003 SET completion_type= @OLD_COMPLETION_TYPE * *
The last position is 2871574, and from the library to start from 2874108, no wonder the newspaper impossible position, is it a power outage when some log in the cache has not yet been written to Binglog? Anyway, let's get back to it.
Stop slave;
Change MASTER to
Master_log_file= ' mysql-bin.000778 ',
master_log_pos=2871574;
Start slave;
Show Slave STATUSG
Sync is OK.
Later, look at the main library's startup log for such a section
Innodb:last MySQL binlog file position 0 2874108, file name./mysql-bin.000778
080922 10:22:09 innodb:started; Log Sequence Number 6 2534366248
080922 10:22:09 [note] recovering after a crash using Mysql-bin
080922 10:22:09 [note] Starting crash recovery ...
080922 10:22:09 [note] Crash recovery finished.
080922 10:22:09 [note]/usr/sbin/mysqld:ready for connections.
The last MySQL binlog file position 0 2874108 is also wrong, where does this information come from? Why is that? Don't understand.
In order to ensure later Binglog write in time, the main library sync_binlog variable set 1.