簡體   English   中英

在EC2上解決Ubuntu 16.04的overcommit_memory和Transparent Huge頁面上的Redis警告

[英]Solving Redis warnings on overcommit_memory and Transparent Huge Pages for Ubuntu 16.04 on EC2

在新的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

但權限不允許您按照警告的建議編輯THP,所以改為

sudo apt install hugepages

並使用sudo vi ~/.bashrc類的sudo vi ~/.bashrc將命令sudo hugeadm --thp-never到.bashrc的底部。

然后只需sudo reboot ,下次你在運行redis-server時SSH,警告就消失了!

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM