【Redis】解决WARNING overcommit_memory is set to 0 Background save may fail under low memory condition.

问题说明

不管是linux直装,还是在docker环境中,启动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.

翻译:

警告内存设置为0!在内存不足的情况下,后台保存可能会失败。若要解决此问题,请将“vm.overcommit_memory = 1”添加到/etc/sysctl.conf,然后重新启动或运行命令“sysctl vm.overcommit_memory=1”使其生效。 

解决方法

编辑主机的/etc/sysctl.conf文件,添加或者配置,保存

vm.overcommit_memory = 1

重启Redis服务即可

你可能感兴趣的:(极客港,redis,java,服务器)