# 首先查看redis容器有没有启动 docker ps # 查看redis容器日志,redis为容器的名称,也可以根据容器ID查询 docker logs redis # 查到日志如下 1:M 20 Jan 22:34:01.568 # WARNING: The TCP backlog setting of 511 cannot be enforced because /proc/sys/net/core/somaxconn is set to the lower value of 128. 1:M 20 Jan 22:34:01.568 # Server started, Redis version 3.2.12 1:M 20 Jan 22:34:01.568 # WARNING overcommit_memory is set to 0! Background save may fail under low memory condition. To fix this issue add 'vm.overcommit_memory = 1' to /etc/sysctl.conf and then reboot or run the command 'sysctl vm.overcommit_memory=1' for this to take effect. 1:M 20 Jan 22:34:01.568 # WARNING you have Transparent Huge Pages (THP) support enabled in your kernel. This will create latency and memory usage issues with Redis. To fix this issue run the command 'echo never > /sys/kernel/mm/transparent_hugepage/enabled' as root, and add it to your /etc/rc.local in order to retain the setting after a reboot. Redis must be restarted after THP is disabled. 1:M 20 Jan 22:34:02.012 # Bad file format reading the append only file: make a backup of your AOF file, then use ./redis-check-aof --fix <filename> 

解决办法

# 根据提示我们需要对AOF文件进行修复,先找到redis-check-aof修复工具 find / -name redis-check-aof # 在找到坏掉的redis备份文件,/home/docker/是安装docker的目录,不知道可以直接从/目录搜索 find /home/docker/ -name *.aof # 找到后进行修复即可 /usr/bin/redis-check-aof --fix  /home/docker/volumes/2e61821da1e1f391dc25f3bf54aec0ee6a18653c94bc0ec79bd5292bf27f6627/_data/appendonly.aof # 重新启动redis即可 docker start redis 


从一个菜鸟进阶成一个老菜鸟