docker-redis容器無法啟動問題解決辦法


# 首先查看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


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM