错误图示:
关键提示:
ResponseError: 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 error.
网上查了一下,有人也遇到类似的问题,并且给出了很好的分析(详见:http://www.linuxidc.com/Linux/2012-07/66079.htm),简单地说:Redis在保存数据到硬盘时为了避免主进程假死,需要Fork一份主进程,然后在Fork进程内完成数据保存到硬盘的操作,如果主进程使用了4GB的内存,Fork子进程的时候需要额外的4GB,此时内存就不够了,Fork失败,进而数据保存硬盘也失败了。
解决方法
- 如果你维护自己的redis,参考https://pydelion.com/2013/05/27/redis-cant-save-in-background-fork-cannot-allocate-memory/
- 如果只是使用redis,临时解决方法
redis-cli -h 10.213.162.69 -p 16379
10.213.162.69:16379> config set stop-writes-on-bgsave-error no
OK