Bad file format reading the append only file: make a backup of your AOF file

Bad file format reading the append only file: make a backup of your AOF file

蓝科迪梦
2022-11-24 / 0 评论 / 254 阅读 / 正在检测是否收录...
温馨提示:
本文最后更新于2022年11月24日,已超过758天没有更新,若内容或图片失效,请留言反馈。
服务器重启导致 redis服务restart。查看日志发现是redis 持久化文件损坏,redis重启时通过aof文件恢复数据失败,导致redis服务无法正常启动。

解决方法:

不知道redis-check-aof文件在哪

[root@VM-8-5-centos ~]# find / -name redis-check-aof
/www/server/redis/src/redis-check-aof
2.手动恢复aof文件

[root@VM-8-5-centos ~]# cd /www/server/redis
[root@VM-8-5-centos redis]# /www/server/redis/src/redis-check-aof --fix appendonly.aof
The AOF appears to start with an RDB preamble.
Checking the RDB preamble to start:
[offset 0] Checking RDB file --fix
[offset 26] AUX FIELD redis-ver = '6.2.6'
[offset 40] AUX FIELD redis-bits = '64'
[offset 52] AUX FIELD ctime = '1646625721'
[offset 67] AUX FIELD used-mem = '84558568'
[offset 83] AUX FIELD aof-preamble = '1'
[offset 85] Selecting DB ID 0
[offset 1424] Selecting DB ID 1
[offset 24008] Selecting DB ID 4
[offset 25494692] Selecting DB ID 10
[offset 25511397] Selecting DB ID 12
[offset 25516496] Selecting DB ID 13
[offset 25518583] Selecting DB ID 14
[offset 25522159] Selecting DB ID 15
[offset 25523418] Checksum OK
[offset 25523418] \o/ RDB looks OK! \o/
[info] 55 keys read
[info] 24 expires
[info] 23 already expired
RDB preamble is OK, proceeding with AOF tail...
0x         252e33b: Expected prefix '*', got: '
AOF analyzed: size=38986653, ok_up_to=38986555, ok_up_to_line=396846, diff=98
This will shrink the AOF from 38986653 bytes, with 98 bytes, to 38986555 bytes
Continue? [y/N]: y
Successfully truncated AOF
You have new mail in /var/spool/mail/root
[root@VM-8-5-centos redis]#
3.重新启动redis,发现redis启动成功!(部分依赖该redis的程序也需要重新启动)
0

评论

博主关闭了所有页面的评论