[英]How to disable Transparent Huge Pages (THP) in Ubuntu 16.04LTS
I am setting up an ambari cluster with 3 virtualbox VMs running Ubuntu 16.04LTS.我正在设置一个带有 3 个运行 Ubuntu 16.04LTS 的虚拟机 VM 的 ambari 集群。 However I get the below warning:
但是我收到以下警告:
The following hosts have Transparent Huge Pages (THP) enabled.
THP should be disabled to avoid potential Hadoop performance issues.
How can I disable THP in Ubuntu 16.04?如何在 Ubuntu 16.04 中禁用 THP?
Did you try this command:你有没有试过这个命令:
sudo su
echo never > /sys/kernel/mm/transparent_hugepage/enabled
? ?
Alternatively, you may install hugepages或者,您可以安装大 页面
sudo su
apt-get install hugepages
hugeadm --thp-never
As mentioned by @Anthony , the effect would not persist after a reboot.正如@Anthony所提到的,重启后效果不会持续。 Use your distribution-specific method to do that every time after reboot.
每次重新启动后,使用特定于发行版的方法来执行此操作。
Install :安装 :
sudo apt install hugepages
Then run :然后运行:
sudo hugeadm --thp-never
To persist the changes you can add this last command to /etc/rc.local要保留更改,您可以将最后一条命令添加到 /etc/rc.local
To disable Transparent Huge Pages (THP) permanently choose one of the following options:要禁用透明大页面(THP)永久选择下列选项之一:
Via GRUB options (preferred):通过 GRUB 选项(首选):
Edit /etc/default/grub
to add transparent_hugepage=never
to the GRUB_CMDLINE_LINUX_DEFAULT
option:编辑
/etc/default/grub
以将transparent_hugepage=never
添加到GRUB_CMDLINE_LINUX_DEFAULT
选项:
GRUB_CMDLINE_LINUX_DEFAULT="transparent_hugepage=never quiet splash"
After that, run update-grub
command.之后,运行
update-grub
命令。 (Need reboot to take effect) (需要重启才能生效)
Edit /etc/rc.local
and put following script before exit 0
编辑
/etc/rc.local
并在exit 0
之前放置以下脚本
if test -f /sys/kernel/mm/transparent_hugepage/enabled; then
echo never > /sys/kernel/mm/transparent_hugepage/enabled
fi
* To avoid reboot (as mentioned before), you can disable it by # echo never > /sys/kernel/mm/transparent_hugepage/enabled
command. * 为避免重启(如前所述),您可以通过
# echo never > /sys/kernel/mm/transparent_hugepage/enabled
命令禁用它。
下面的 3 个命令修复了 Ubuntu(14.x/16.x) 上的问题,并使其在系统启动时持久存在。
sudo apt-get install hugepages
sudo hugeadm --thp-never
sudo /bin/sed -i '$i /usr/bin/hugeadm --thp-never' /etc/rc.local
All of these answers are out of date.所有这些答案都已过时。 Tried all of them, and the values keep getting overwritten.
尝试了所有这些,并且值不断被覆盖。
The guide here actually works: https://docs.mongodb.com/manual/tutorial/transparent-huge-pages/这里的指南实际上有效: https : //docs.mongodb.com/manual/tutorial/transparent-huge-pages/
It needs to be a service that runs at startup properly, just follow this guide它需要是在启动时正常运行的服务,只需按照本指南
Worked on Ubuntu 19.04, finally suppressed the redis warnings在 Ubuntu 19.04 上工作,终于压制了 redis 警告
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.