码迷,mamicode.com
首页 > 数据库 > 详细

Redis "MISCONF Redis is configured to save RDB snapshots, but is currently not able to persist on disk"问题

时间:2016-02-03 11:40:45      阅读:187      评论:0      收藏:0      [点我收藏+]

标签:

今天在程序中,jedis put数据到redis过程中,“MISCONF Redis is configured to save RDB snapshots, but is currently not able to persist on disk”报错;

再查看Redis日志,看到有这样的错误提示“Can’t save in background: fork: Cannot allocate memory”,这个提示很明显"Fork进程时内存不够用了!",但内存明明还有一个多G;

经网上查询,Redis在保存数据到硬盘时为了避免主进程假死,需要Fork一份主进程,然后在Fork进程内完成数据保存到硬盘的操作,如果主进程使用了4GB的内存,Fork子进程的时候需要额外的4GB,此时内存就不够了,Fork失败,进而数据保存硬盘也失败了。

解决如下:

执行命令 sysctl vm.overcommit_memory=1

/etc/sysctl.conf 文件添加

vm.overcommit_memory=1

Redis "MISCONF Redis is configured to save RDB snapshots, but is currently not able to persist on disk"问题

标签:

原文地址:http://www.cnblogs.com/sl21100/p/5179195.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!