redis报Can't save in background: fork: Cannot allocate memory错误

1 篇文章 0 订阅

开发那边传过来错误:

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日志:

29300:M 17 Jan 13:50:38.040 * 1 changes in 900 seconds. Saving...
29300:M 17 Jan 13:50:38.040 # Can't save in background: fork: Cannot allocate memory
 

free -g看了下内存,果然没有空间了。

所以:

1、设置最大内存从原来的6G变为4G

2、echo 'vm.overcommit_memory = 1' >> /etc/sysctl.conf     sysctl -p

参数说明:

overcommit_memory=0, 表示内核将检查是否有足够的可用内存供应用进程使用;如果有足够的可用内存,内存申请允许;否则,内存申请失败,并把错误返回给应用进程。
overcommit_memory=1, 表示内核允许分配所有的物理内存,而不管当前的内存状态如何。
overcommit_memory=2, 表示内核允许分配超过所有物理内存和交换空间总和的内存

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值