解决redis Can't save in background: fork: Cannot allocate memory

前面启动Redis时,看到如下警告:


[1958] 13 Aug 16:18:24 # 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.

需要修改/etc/sysctl.conf文件:

vim /etc/sysctl.conf

末尾追加 vm.overcommit_memory = 1
然后执行 sysctl vm.overcommit_memory=1 ,使之生效:

# sysctl vm.overcommit_memory=1  
vm.overcommit_memory = 1  


你可能感兴趣的:(redis)