小编典典

解决EC2上Ubuntu 16.04的overcommit_memory和透明大页面上的Redis警告

redis

在新的Ubuntu 16.04 EC2实例上,警告如下所示:

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.
WARNING you have Transparent Huge Pages (THP) support enabled in your kernel. This will create latency and memory usage issues with Redis. To fix this issue run the command 'echo never > /sys/kernel/mm/transparent_hugepage/enabled' as root, and add it to your /etc/rc.local in order to retain the setting after a reboot. Redis must be restarted after THP is disabled.

如何永久消除它们?


阅读 496

收藏
2020-06-20

共1个答案

小编典典

像警告提示,只需添加行vm.overcommit_memory=1至底部/etc/sysctl.conf,喜欢的东西sudo vi /etc/sysctl.conf

但是,权限不允许您按照警告的提示来编辑THP,而是这样做

sudo apt install hugepages

并将命令添加sudo hugeadm --thp-never到.bashrc的底部,类似sudo vi ~/.bashrc

然后sudo reboot,下一次您运行SSH时redis-server,警告消失了!

2020-06-20