我刚刚安装了Centos 7的新实例
Linux version 3.10.0-229.1.2.el7.x86_64 (builder@kbuilder.dev.centos.org) (gcc version 4.8.2 20140120 (Red Hat 4.8.2-16) (GCC) ) #1 SMP Fri Mar 27 03:04:26 UTC 2015
我安装了mongodb 3.0,当我连接时,我有这个奇怪的消息:
2015-04-15T07:48:55.583+0000 I CONTROL [initandlisten] ** WARNING: /sys/kernel/mm/transparent_hugepage/enabled is 'always'.
2015-04-15T07:48:55.583+0000 I CONTROL [initandlisten] ** We suggest setting it to 'never'
2015-04-15T07:48:55.583+0000 I CONTROL [initandlisten]
2015-04-15T07:48:55.583+0000 I CONTROL [initandlisten] ** WARNING: /sys/kernel/mm/transparent_hugepage/defrag is 'always'.
2015-04-15T07:48:55.583+0000 I CONTROL [initandlisten] ** We suggest setting it to 'never'
如何为此版本禁用THP?
我没有运气的事情
我可以禁用它运行此命令:
echo never > /sys/kernel/mm/transparent_hugepage/enabled
echo never > /sys/kernel/mm/transparent_hugepage/defrag
但是当我重新启动时,问题再次出现。
我尝试修改/etc/rc.local添加这些行:
if test -f /sys/kernel/mm/transparent_hugepage/defrag; then
echo never > /sys/kernel/mm/transparent_hugepage/defrag
fi
if test -f /sys/kernel/mm/transparent_hugepage/enabled; then
echo never > /sys/kernel/mm/transparent_hugepage/enabled
fi
exit 0
重启并没有结果
我还尝试修改/ etc / default / grub ...
答案 0 :(得分:6)
我遇到了同样的问题,并通过在/etc/rc.local
中写下来解决了这个问题:
echo never > /sys/kernel/mm/transparent_hugepage/enabled;
echo never > /sys/kernel/mm/transparent_hugepage/defrag;
我还授予了/etc/rc.d/rc.local
现在每次启动时都会被禁用。