简体   繁体   中英

Mongodb startup warnings after update

I updated the mongodb using

sudo apt-get install mongodb-org

mongodb is updated from 2.4 to 3.0. Soon after I connected to mongo shell, it is displaying the below start up warnings. I am unaware of fixing it. Suggest me how to fix these warnings?

MongoDB shell version: 3.0.1
connecting to: test  
Server has startup warnings: 
2015-04-03T13:37:53.536+0530 I CONTROL  [initandlisten] 
2015-04-03T13:37:53.536+0530 I CONTROL  [initandlisten] ** WARNING:        /sys/kernel/mm/transparent_hugepage/enabled is 'always'.
2015-04-03T13:37:53.536+0530 I CONTROL  [initandlisten] **        We suggest setting it to 'never'
2015-04-03T13:37:53.536+0530 I CONTROL  [initandlisten] 
2015-04-03T13:37:53.537+0530 I CONTROL  [initandlisten] ** WARNING: /sys/kernel/mm/transparent_hugepage/defrag is 'always'.
2015-04-03T13:37:53.537+0530 I CONTROL  [initandlisten] **        We suggest setting it to 'never'
2015-04-03T13:37:53.537+0530 I CONTROL  [initandlisten] 

Adding the following lines preceding exit 0 in /etc/rc.local file with root privileges did the magic. Rebooted the OS after saving the file.Then warnings disappeared in the mongo shell.

Source: MongoDB documentation( http://docs.mongodb.org/manual/reference/transparent-huge-pages/#transparent-huge-pages-thp-settings )

if test -f /sys/kernel/mm/transparent_hugepage/khugepaged/defrag; then
echo 0 > /sys/kernel/mm/transparent_hugepage/khugepaged/defrag
fi
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

Those warnings pop up due to Transparent Huge Pages (THP) settings.

As stated in the official MongoDB documentation :

However, THP is known to perform poorly under database workloads, which tend to have sparse rather than contiguous memory access patterns. You must disable THP on Linux machines used to run MongoDB instances to ensure best performance.

There is a similar thread on StackOverflow where you can find a possible solution that recommends updating the mongod.conf file so that you overwrite the THP properties indicated by MongoDB.

It seems like a lot of people are having the same issue. You can find the answer in the MongoDB documentation , or you can look at a similar question that was asked on StackOverflow .

One person suggested typing in the console sudo service mongod restart , which worked for them.

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