Ubuntu Server 16.04.1 LTS 和 MongoDB 无法正常工作

Ubuntu Server 16.04.1 LTS 和 MongoDB 无法正常工作

我安装了 Ubuntu Server 16.04.1 LTS,过去 5 天一直遇到问题。输入以下命令后,其中一个问题如下:mongo

Server has startup warnings:
2016-12-19T08:40:14.039-0800 I STORAGE  [initandlisten]
2016-12-19T08:40:15.984-0800 I CONTROL  [initandlisten]
2016-12-19T08:40:15.984-0800 I CONTROL  [initandlisten] ** WARNING: Access control is not enabled for the database.
2016-12-19T08:40:15.984-0800 I CONTROL  [initandlisten] **          Read and write access to data and configuration is unrestricted.
2016-12-19T08:40:15.984-0800 I CONTROL  [initandlisten]
2016-12-19T08:40:15.984-0800 I CONTROL  [initandlisten]
2016-12-19T08:40:15.984-0800 I CONTROL  [initandlisten] ** WARNING: /sys/kernel/mm/transparent_hugepage/enabled is 'always'.
2016-12-19T08:40:15.984-0800 I CONTROL  [initandlisten] **        We suggest setting it to 'never'
2016-12-19T08:40:15.984-0800 I CONTROL  [initandlisten]
2016-12-19T08:40:15.984-0800 I CONTROL  [initandlisten] ** WARNING: /sys/kernel/mm/transparent_hugepage/defrag is 'always'.
2016-12-19T08:40:15.984-0800 I CONTROL  [initandlisten] **        We suggest setting it to 'never'
2016-12-19T08:40:15.984-0800 I CONTROL  [initandlisten]

我是 Ubuntu 新手,希望得到一步步的解决方案

答案1

您有两个问题需要处理:

  1. 您尚未配置安全功能在你的mongodb

    • 按照官方步骤操作这里
  2. 禁用透明大页面(THP):

    • 有两个选择这里,看看第二个答案,但如果接受的答案对你有用:

      • /etc/rc.local在文件之前添加以下内容出口 0

        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
        
      • 编辑/etc/default/grub

        • 追加transparent_hugepage=neverGRUB_CMDLINE_LINUX_DEFAULT然后
        • 跑步update-grub

资料来源:

如何修改“/sys/kernel/mm/transparent_hugepage/enabled”

https://docs.mongodb.com/manual/tutorial/transparent-huge-pages/#transparent-huge-pages-thp-settings

https://www.mongodb.com/blog/post/mongodb-security-part-ii-10-mistakes-that-c​​an

相关内容