I CONTROL [initandlisten] ** WARNING: /sys/kernel/mm/transparent_hugepage/enabled is 'always'.,transparenthugepage
啟動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.pid
和end script
.之間即可,注意空格的對齊。
if test -f /sys/kernel/mm/transparent_hugepage/enabled; then echo never > /sys/kernel/mm/transparent_hugepage/enabledfiif test -f /sys/kernel/mm/transparent_hugepage/defrag; then echo never > /sys/kernel/mm/transparent_hugepage/defragfi
然後重啟mongod服務
deng@deng-Lenovo:~$ sudo service mongod restartmongod stop/waitingmongod start/running, process 26127deng@deng-Lenovo:~$ mongoMongoDB shell version: 3.0.4connecting to: test>