在新的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.
如何永久消除它们?
像警告提示,只需添加行vm.overcommit_memory=1至底部/etc/sysctl.conf,喜欢的东西sudo vi /etc/sysctl.conf。
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 hugeadm --thp-never
sudo vi ~/.bashrc
然后sudo reboot,下一次您运行SSH时redis-server,警告消失了!
sudo reboot
redis-server