Mongo数据库服务器启动警告

时间:2015-09-05 03:44:13

标签: mongodb

我已经看到其他人有启动警告,但我似乎无法在这个上找到任何东西。我在Ubuntu 14.04上运行的一些笔记我的mongo版本是3.0.5(我也尝试过3.0.6类似的问题)我试过停止/重新启动无效。

它似乎在寻找一个不存在的文件,所以我不确定是否有人知道这个文件的用途。这是我启动时得到的日志($ mongo)

MongoDB shell version: 3.0.5
connecting to: test
Server has startup warnings:
2015-09-04T23:25:54.707-0400 I STORAGE  [initandlisten] unable to validate readahead settings due to error: boost::filesystem::status: Permission denied: "/sys/dev/block/8:1/queue/read_ahead_kb"
2015-09-04T23:25:54.707-0400 I STORAGE  [initandlisten] for more information, see http://dochub.mongodb.org/core/readahead
2015-09-04T23:25:54.793-0400 I CONTROL  [initandlisten]
2015-09-04T23:25:54.793-0400 I CONTROL  [initandlisten] ** WARNING: Cannot detect if NUMA interleaving is enabled. Failed to probe "/sys/devices/system/node/node1": Permission denied
2015-09-04T23:25:54.793-0400 W CONTROL  [initandlisten]
2015-09-04T23:25:54.793-0400 W CONTROL  [initandlisten] Failed to probe "/sys/kernel/mm/transparent_hugepage": Permission denied
2015-09-04T23:25:54.793-0400 W CONTROL  [initandlisten]
2015-09-04T23:25:54.793-0400 W CONTROL  [initandlisten] Failed to probe "/sys/kernel/mm/transparent_hugepage": Permission denied
2015-09-04T23:25:54.793-0400 I CONTROL  [initandlisten]

我无法找到它正在查找的"/sys/dev/block/8:1/queue/read_ahead_kb"并引用权限被拒绝,如果有所不同,则通过root安装mongo。

有谁知道可能导致此错误的原因是什么?我已经完成了多次mongo安装,但之前没有遇到过这种情况。

2 个答案:

答案 0 :(得分:9)

与OVH / Kimsufi完全相同的问题是由于默认安装了自定义内核。

首先,您需要首先使用常规的ubuntu内核,而不是托管公司修改的内核。

然后,您需要禁用透明的大页面来删除警告并提高与内存管理相关的内存性能:

  1. 将此脚本添加为/etc/init.d/disable-transparent-hugepage

    #!/bin/sh
    ### BEGIN INIT INFO
    # Provides:          disable-transparent-hugepages
    # Required-Start:    $local_fs
    # Required-Stop:
    # X-Start-Before:    mongod mongodb-mms-automation-agent
    # Default-Start:     2 3 4 5
    # Default-Stop:      0 1 6
    # Short-Description: Disable Linux transparent huge pages
    # Description:       Disable Linux transparent huge pages, to improve
    #                    database performance.
    ### END INIT INFO
    
    case $1 in
      start)
        if [ -d /sys/kernel/mm/transparent_hugepage ]; then
          thp_path=/sys/kernel/mm/transparent_hugepage
        elif [ -d /sys/kernel/mm/redhat_transparent_hugepage ]; then
          thp_path=/sys/kernel/mm/redhat_transparent_hugepage
        else
          return 0
        fi
    
        echo 'never' > ${thp_path}/enabled
        echo 'never' > ${thp_path}/defrag
    
        unset thp_path
        ;;
    esac
    
  2. 使脚本可执行sudo chmod 755 /etc/init.d/disable-transparent-hugepage

  3. 在启动sudo update-rc.d disable-transparent-hugepage defaults

  4. 注册

    参考:https://docs.mongodb.org/v3.0/tutorial/transparent-huge-pages/

答案 1 :(得分:0)

我正在添加我的解决方案,因为它可能对那些希望使用调谐的替代解决方案的人有所帮助。

对于RHEL 7虚拟机,我使用此解决方案,它也应适用于非VM。服务器上运行着一个已调整的守护程序,我用它来解决该问题。

我将以下2个文件放入“ / etc / tuned / mongodb”文件夹中。 .conf文件引用VM场上的构建随附的“虚拟来宾”设置,以保留VM所需的设置,然后仅更改MongoDB所需的参数。脚本部分是必需的,因为更改碎片整理参数的唯一方法是通过脚本。

# /etc/tuned/mongodb/tuned.conf
[main]
include=virtual-guest

[vm]
transparent_hugepages=never

[script]
script=mongodb.sh

#!/bin/sh
# /etc/tuned/mongodb/mongodb.sh

. /usr/lib/tuned/functions

start() {
    echo never > /sys/kernel/mm/transparent_hugepage/defrag
    return 0
}

stop() {
    return 0
}

process $@

制作“ /etc/tuned/mongodb/mongodb.sh”可执行文件,并将“ / etc / tuned / mongodb”文件夹递归归root:root拥有。

然后使用“ tuned-adm”命令检查并更改活动配置文件。

sudo tuned-adm active
Current active profile: virtual-guest

然后

sudo tuned-adm profile mongodb

然后

sudo tuned-adm active
Current active profile: mongodb

此后,MongoDB的大页面设置应该可以。

相关问题