I\'ve seen others with startup warnings but I can\'t seem find anything on this one. A few notes I\'m running on Ubuntu 14.04 my mongo version is 3.0.5 (I\'ve also tried 3.0
I am adding my solution as it may be helpful for those who look for an alternative solution using tuned.
For RHEL 7 virtual machines I use this solution, it should work for non-VMs also. There is a tuned daemon running on the servers and I use that to address the issue.
I put the following 2 files into the "/etc/tuned/mongodb" folder. The .conf file is referencing the "virtual-guest" settings that came with the builds on the VM farm, to preserve the settings that are necessary for VMs and then I change only the parameters that are needed for MongoDB. The script part is necessary as the only way to change the defrag parameter was through script.
# /etc/tuned/mongodb/tuned.conf
[main]
include=virtual-guest
[vm]
transparent_hugepages=never
[script]
script=mongodb.sh
and
#!/bin/sh
# /etc/tuned/mongodb/mongodb.sh
. /usr/lib/tuned/functions
start() {
echo never > /sys/kernel/mm/transparent_hugepage/defrag
return 0
}
stop() {
return 0
}
process $@
Make the "/etc/tuned/mongodb/mongodb.sh" executable and make the "/etc/tuned/mongodb" folder recursively owned by root:root.
Then use the "tuned-adm" command to check and change the active profile.
sudo tuned-adm active
Current active profile: virtual-guest
then
sudo tuned-adm profile mongodb
then
sudo tuned-adm active
Current active profile: mongodb
After this, the huge-pages settings should be OK for MongoDB.