我的关注 |
¥0.1 WARNING: /sys/kernel/mm/transparent_hugepage/enabled is 'always'
0

启动mongodb时出现下面的错误:

  1. Server has startup warnings:
  2. 2016-11-28T00:46:04.682+0800 I CONTROL [initandlisten]
  3. 2016-11-28T00:46:04.682+0800 I CONTROL [initandlisten] ** WARNING: /sys/kernel/mm/transparent_hugepage/enabled is 'always'.
  4. 2016-11-28T00:46:04.682+0800 I CONTROL [initandlisten] ** We suggest setting it to 'never'
  5. 2016-11-28T00:46:04.682+0800 I CONTROL [initandlisten]
  6. 2016-11-28T00:46:04.682+0800 I CONTROL [initandlisten] ** WARNING: /sys/kernel/mm/transparent_hugepage/defrag is 'always'.
  7. 2016-11-28T00:46:04.682+0800 I CONTROL [initandlisten] ** We suggest setting it to 'never'
  8. 2016-11-28T00:46:04.682+0800 I CONTROL [initandlisten]

请问如何解决?

大智若愚
修改
评论(0)
1个回答
0
采纳

方法一:

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

  1. if test -f /sys/kernel/mm/transparent_hugepage/enabled; then
  2. echo never > /sys/kernel/mm/transparent_hugepage/enabled
  3. fi
  4. if test -f /sys/kernel/mm/transparent_hugepage/defrag; then
  5. echo never > /sys/kernel/mm/transparent_hugepage/defrag
  6. fi

然后重启下服务器或mongod

方法二:

  1. 输入命令:vi /etc/rc.local
  2. 输入
    1. echo never > /sys/kernel/mm/transparent_hugepage/enabled
    2. echo never > /sys/kernel/mm/transparent_hugepage/defrag
    重启服务器即可。
采纳答案
佛法不二
修改
评论 (0)
撰写回答