解决EC2上Ubuntu 16.04的overcommit_memory和透明大页面上的Redis警告 [英] Solving Redis warnings on overcommit_memory and Transparent Huge Pages for Ubuntu 16.04 on EC2

查看:193
本文介绍了解决EC2上Ubuntu 16.04的overcommit_memory和透明大页面上的Redis警告的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

On a fresh Ubuntu 16.04 EC2 instance the warnings appear like so:

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.

Like the warning suggests, just add the line vm.overcommit_memory=1 to the bottom of /etc/sysctl.conf, with something like sudo vi /etc/sysctl.conf.

但是根据警告提示,权限不允许您编辑THP,所以

But permissions don't allow you to edit THP as the warning suggests, so instead do

sudo apt install hugepages

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

and add the command sudo hugeadm --thp-never to the bottom of your .bashrc, with something like sudo vi ~/.bashrc.

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

Then just sudo reboot and next time you SSH in run redis-server and the warnings are gone!

这篇关于解决EC2上Ubuntu 16.04的overcommit_memory和透明大页面上的Redis警告的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆