When a computer suddenly powers down, boot out of the 080922 10:29:01 [Note] Slave SQL thread initialized, starting replication in log mysql-bin.000778 at position 2874108, relay log \'. /relay-bin.003287 \ 'position: 2874245
The following error is always reported when several MySQL servers suddenly fail and the replication fails to start after the server is restarted:
080922 10:29:01 [Note] Slave SQL thread initialized, starting replication in log 'mysql-bin.000778 'at position 2874108, relay log'./relay-bin.003287' position: 2874245
080922 10:29:01 [Note] Slave I/O thread: connected to master 'replication @ 192.168.0.10: 100', replication started in log 'mysql-B in.000778 'at position 3306
080922 10:29:01 [ERROR] Error reading packet from server: Client requested master to start replication from impossible position (se rver_errno = 1236)
080922 10:29:01 [ERROR] Got fatal error 1236: 'client requested master to start replication from impossible position' from master wh en reading data from binary log
Why is impossible position reported? Open the mysql-bin.000778 to 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 the database starts from 2874108. No wonder impossible position is reported. Is it because some logs have not been written into the binglog in the cache when the power is down? Recover it first.
Stop slave;
CHANGE MASTER
MASTER_LOG_FILE = 'mysql-bin.000778 ',
MASTER_LOG_POS = 2871574;
Start slave;
Show slave statusG
Synchronization is normal ..
Later, check the startup log of the master database.
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.
Here, the Last MySQL binlog file position 0 2874108 is also incorrect. Where does this information come from? Why? I don't understand.
To ensure timely Writing of binglog in the future, set the main database sync_binlog variable to 1.