您好,欢迎访问一九零五行业门户网

MySQL断电,出现 Error 1236_MySQL

bitscn.com
今天几台mysql服务器突然停电,重启后复制无法启动,总是报如下错误:
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: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 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
为什么会报impossible position呢?打开mysql-bin.000778看看。
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*/
最后一个position是2871574,而从库要从2874108开始,难怪报impossible position,难道是断电时有部分log在缓存中还没来得及写入binglog?无论如何先恢复再说吧
stop slave;
change master to
master_log_file='mysql-bin.000778',
master_log_pos=2871574;
start slave;
show slave status/g
同步正常。。
后来查看主库的启动日志中这样一段
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.
这里last mysql binlog file position 0 2874108也是错误的,这个信息到底是哪里来的呢?为什么会这样呢?不明白。
为了保证以后binglog及时写入,将主库sync_binlog变量设置1。
bitscn.com
其它类似信息

推荐信息