I CONTROL [initandlisten] ** WARNING: /sys/kernel/mm/transparent_hugepage/enabled is 'always'.

启动mongodb时提示下方信息

Server has startup warnings: 
2015-06-18T17:20:17.944+0800 I CONTROL  [initandlisten] 
2015-06-18T17:20:17.944+0800 I CONTROL  [initandlisten] ** WARNING: /sys/kernel/mm/transparent_hugepage/enabled is 'always'.
2015-06-18T17:20:17.944+0800 I CONTROL  [initandlisten] **        We suggest setting it to 'never'
2015-06-18T17:20:17.944+0800 I CONTROL  [initandlisten] 
2015-06-18T17:20:17.944+0800 I CONTROL  [initandlisten] ** WARNING: /sys/kernel/mm/transparent_hugepage/defrag is 'always'.
2015-06-18T17:20:17.944+0800 I CONTROL  [initandlisten] **        We suggest setting it to 'never'
2015-06-18T17:20:17.944+0800 I CONTROL  [initandlisten] 

只需打开/etc/init/mongod.conf文件,将下方的代码添加到chown $DEAMONUSER /var/run/mongodb.pidend script.之间即可,注意空格的对齐。

if test -f /sys/kernel/mm/transparent_hugepage/enabled; then
   echo never > /sys/kernel/mm/transparent_hugepage/enabled
fi
if test -f /sys/kernel/mm/transparent_hugepage/defrag; then
   echo never > /sys/kernel/mm/transparent_hugepage/defrag
fi

然后重启mongod服务

deng@deng-Lenovo:~$ sudo service mongod restart
mongod stop/waiting
mongod start/running, process 26127
deng@deng-Lenovo:~$ mongo
MongoDB shell version: 3.0.4
connecting to: test
> 



你可能感兴趣的:(mongodb,linux,server,ubuntu,kernel)