redis无法向磁盘写入RDB的报错

当Redis尝试使用RDB进行持久化时,由于'overcommit_memory'设置为0,导致fork()错误。尽管有大量可用RAM,但后台保存仍可能因低内存条件而失败。通过将'vm.overcommit_memory'设置为1并重新启动或运行'sysctl vm.overcommit_memory=1'可以解决此问题。此外,Redis的Fork过程需要与数据集大小相等的内存,这在内存不足时会导致失败。
摘要由CSDN通过智能技术生成

测服报错信息:

Caused by: redis.clients.jedis.exceptions.JedisDataException:

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使用RDB进行持久化,但是现在RDB快照时失败了;因为开启了stop-writes-on-bgsave-error选项,RDB失败之后就禁止执行修改数据的命令了。Jedis等客户端连接时就会报上述错误。

查看redis服务器的日志:

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_memory被设置成0,redis后台的保存操作在低可用内存的情况下会失败。这个时候很清楚

  • 1
    点赞
  • 7
    收藏
    觉得还不错? 一键收藏
  • 2
    评论
评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值