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

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了Redis "MISCONF Redis is configured to save RDB snapshots, but is currently not able to persist on di相关的知识,希望对你有一定的参考价值。

今天在程序中,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 di的主要内容,如果未能解决你的问题,请参考以下文章

Redis常见报错之 Redis::CommandError (MISCONF Redis is configured to save RDB snapshots, but it is current

连接Redis后执行命令错误 MISCONF Redis is configured to save RDB snapshots

redis “出现error) MISCONF Redis is configured to save RDB snapshots, but it is currently 解决办法”

redis.clients.jedis.exceptions.JedisDataException: MISCONF Redis is configured to save RDB snapshots

redis.clients.jedis.exceptions.JedisDataException: MISCONF Redis is configured to save RDB snapshots

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