Redis 由于机器重启导致启动出现该错误:
Bad file format reading the append only file: make a backup of your AOF file, then use ./redis-check-aof --fix <filename>
解决方法:
1、首先启动redis看redis的启动的状态
/opt/redis/sbin/redis.service restart
ps -ef | grep redis
发现没有启动,然后看查redis的日志文件
2、找到Redis的log文件 /opt/redis/logs/redis.log
发现报错:

3、去redis数据目录,将aof文件备份,用redis-check-aof工具修复
即执行命令:
/opt/redis/bin/redis-check-aof -- fix /mnt/data/redis/data/appendonly.aof
不知道redis-check-aof 和备份文件appendonly.aof 存放路径的可以通过命令查找:
find / -name redis-check-aof
find / -name appendonly.aof

4、重启redis服务:/opt/redis/sbin/redis.service restart