Redis 错误内容:
MISCONF Redis is configured to save RDB snapshots, but it is currently not able to persist on disk. Commands that may modify the data set are disabled, because this instance is configured to report errors during writes if RDB snapshotting fails (stop-writes-on-bgsave-error option). Please check the Redis logs for details about the RDB error.
Redis被配置为保存数据库快照,但它目前不能持久化到硬盘。用来修改集合数据的命令不能用。请查看Redis日志的详细错误信息。
出错原因:
强制关闭Redis快照导致不能持久化
解决方法:
将 stop-writes-on-bgsave-error 设置为 no ,该方法只能忽略错误
在 Redis-cli 客户端执行
127.0.0.1:6379> config set stop-writes-on-bgsave-error no
参考自:http://www.jianshu.com/p/3aaf21dd34d6
http://www.cnblogs.com/qq78292959/p/3994349.html
查看 Redis 日志 ,提示“Can’t save in background: fork: Cannot allocate memory”,这个提示很明显"Fork进程时内存不够用了!"(还是内存的问题)。
Redis在保存数据到硬盘时为了避免主进程假死,需要Fork一份主进程,然后在Fork进程内完成数据保存到硬盘的操作,如果主进程使用了4GB的内存,Fork子进程的时候需要额外的4GB,此时内存就不够了,Fork失败,进而数据保存硬盘也失败了。
解决方法:
在/etc/sysctl.conf 添加一项 'vm.overcommit_memory = 1' ,然后重启(或者运行命令'sysctl vm.overcommit_memory=1' )使其生效。)