排障集锦:九九八十一难之第十难!mysq备份恢复,Could not read entry at offset *: Error in log format or read error.

2020-09-03 10:24:25 浏览数 (1)

断点恢复报错信息如下

代码语言:javascript复制
[root@localhost opt]# mysqlbinlog --no-defaults --start-position='655' /usr/local/mysql/data/mysql-bin.000002 | mysql -uroot -p
Enter password: ERROR: Error in Log_event::read_log_event(): 'read error', data_len: 1107206300, event_type: 88
ERROR: Could not read entry at offset 655: Error in log format or read error.

经查阅资料发现 --start-position=‘655’ 是个存储过程的中间位置,无法直接读取,所以会报错。

解决方法

代码语言:javascript复制
[root@localhost opt]# vim bak.txt   '查看备份日志文件找到下一个position位置进行恢复'
# at 563
#200823 13:29:04 server id 1  end_log_pos 617 CRC32 0xd664ad61  Table_map: `shang`.`info` mapped to number 127
# at 617
#200823 13:29:04 server id 1  end_log_pos 665 CRC32 0x9ca93efb  Delete_rows: table id 127 flags: STMT_END_F
### DELETE FROM `shang`.`info`
### WHERE
###   @1=2
###   @2='qqqq'
###   @3=88.00
# at 665
#200823 13:29:04 server id 1  end_log_pos 696 CRC32 0x035b14bc  Xid = 39
COMMIT/*!*/;
# at 696
#200823 13:29:27 server id 1  end_log_pos 761 CRC32 0x31d8e77b  Anonymous_GTID  last_committed=2        sequence_number=3
SET @@SESSION.GTID_NEXT= 'ANONYMOUS'/*!*/;

[root@localhost opt]# mysqlbinlog --no-defaults --start-position='696' /usr/local/mysql/data/mysql-bin.000002 | mysql -uroot -p  '成功恢复'

0 人点赞