简体   繁体   中英

Mongo DB Server Startup Warnings

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.6 with similar issues) I've tried stoping/ restarting to no avail.

It seems to be looking for a file that does not exist so I'm not sure if anyone is aware of what this file is for. Here is the log I get upon start up ($ mongo)

MongoDB shell version: 3.0.5
connecting to: test
Server has startup warnings:
2015-09-04T23:25:54.707-0400 I STORAGE  [initandlisten] unable to validate readahead settings due to error: boost::filesystem::status: Permission denied: "/sys/dev/block/8:1/queue/read_ahead_kb"
2015-09-04T23:25:54.707-0400 I STORAGE  [initandlisten] for more information, see http://dochub.mongodb.org/core/readahead
2015-09-04T23:25:54.793-0400 I CONTROL  [initandlisten]
2015-09-04T23:25:54.793-0400 I CONTROL  [initandlisten] ** WARNING: Cannot detect if NUMA interleaving is enabled. Failed to probe "/sys/devices/system/node/node1": Permission denied
2015-09-04T23:25:54.793-0400 W CONTROL  [initandlisten]
2015-09-04T23:25:54.793-0400 W CONTROL  [initandlisten] Failed to probe "/sys/kernel/mm/transparent_hugepage": Permission denied
2015-09-04T23:25:54.793-0400 W CONTROL  [initandlisten]
2015-09-04T23:25:54.793-0400 W CONTROL  [initandlisten] Failed to probe "/sys/kernel/mm/transparent_hugepage": Permission denied
2015-09-04T23:25:54.793-0400 I CONTROL  [initandlisten]

I can't locate "/sys/dev/block/8:1/queue/read_ahead_kb" which it is looking for and citing permission denied, mongo was installed via root if that makes a difference.

Does anyone know what might be causing this error? I've done multiple mongo installs and haven't come across this before.

Had the exact same issues with OVH/Kimsufi due to their custom kernel installed by default.

First, you need to have first the regular ubuntu kernel and not one modified by your hosting company.

Then, you need to disable transparent huge pages to remove the warning and improve memory performance related to memory management:

  1. Add this script as /etc/init.d/disable-transparent-hugepage

     #!/bin/sh ### BEGIN INIT INFO # Provides: disable-transparent-hugepages # Required-Start: $local_fs # Required-Stop: # X-Start-Before: mongod mongodb-mms-automation-agent # Default-Start: 2 3 4 5 # Default-Stop: 0 1 6 # Short-Description: Disable Linux transparent huge pages # Description: Disable Linux transparent huge pages, to improve # database performance. ### END INIT INFO case $1 in start) if [ -d /sys/kernel/mm/transparent_hugepage ]; then thp_path=/sys/kernel/mm/transparent_hugepage elif [ -d /sys/kernel/mm/redhat_transparent_hugepage ]; then thp_path=/sys/kernel/mm/redhat_transparent_hugepage else return 0 fi echo 'never' > ${thp_path}/enabled echo 'never' > ${thp_path}/defrag unset thp_path ;; esac 
  2. Make the script executable sudo chmod 755 /etc/init.d/disable-transparent-hugepage

  3. Register it at boot sudo update-rc.d disable-transparent-hugepage defaults

Ref: https://docs.mongodb.org/v3.0/tutorial/transparent-huge-pages/

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM