docker redis警告处理 WARNING Memory overcommit must be enabled; vm.overcommit_memory = 1

提示信息

  • WARNING Memory overcommit must be enabled! Without it, a background save or replication may fail under low memory condition. Being disabled, it can also cause failures without low memory condition, see https://github.com/jemalloc/jemalloc/issues/1328. 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.

  • 操作命令

vi /etc/sysctl.conf
vm.overcommit_memory = 1
#重启 reboot

#或者
sysctl vm.overcommit_memory=1
或
echo 1 > /proc/sys/vm/overcommit_memory

#查看修改结果 

cat /proc/sys/vm/overcommit_memory

docker中设置

    environment:
      - ENABLE_OVERCOMMIT_MEMORY=true

#或者
docker run     -e ENABLE_OVERCOMMIT_MEMORY=true

你可能感兴趣的