Redis故障
Redis is configured to save RDB snapshots, but is currently not able to persist on disk. Commands that may modify the data set are disabled. Please check Redis logs for details about the error.; nested exception is redis.clients.jedis.exceptions.JedisDataException: MISCONF Redis is configured to save RDB snapshots, but is currently not able to persist on disk. Commands that may modify the data set are disabled. Please check Redis logs for details about the erro
有道翻译
Redis被配置为保存RDB快照,但目前无法持久化到磁盘上。可能修改数据集的命令被禁用。请检查Redis日志的详细错误。Redis被配置为保存RDB快照,但目前不能持久化到磁盘上。可能修改数据集的命令被禁用。请检查Redis日志的详细错误
查看redis的日志文件
如果不知道日志文件在哪里,在redis.conf文件中查看配置
whereis redis.conf
配置文件中包含大量注释,过滤掉注释查看内容(找到文件当前目录)
grep -v "^#" redis.conf | more
我的路径是:logfile /var/log/redis/redis.log
查看日志内容
Can't save in background: fork: Cannot allocate memory
重启后会报警告
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
内存不足解决办法
允许overcommit
编辑文件:/etc/sysctl.conf,增加一行
vm.overcommit_memory=1
执行命令,完美解决
sysctl -p
redis启动时其它警告
The TCP backlog setting of 511 cannot be enforced because /proc/sys/net/core/somaxconn is set to the lower value of 128.
解决办法
- 临时解决办法
echo 511 > /proc/sys/net/core/somaxconn
- 一劳永逸,编辑文件:/etc/sysctl.conf,增加一行
net.core.somaxconn= 1024
执行命令,完美解决
sysctl -p