Mongo DB Server Startup Warnings

前端 未结 2 1514
孤独总比滥情好
孤独总比滥情好 2021-01-13 16:55

I\'ve seen others with startup warnings but I can\'t seem find anything on this one. A few notes I\'m running on Ubuntu 14.04 my mongo version is 3.0.5 (I\'ve also tried 3.0

2条回答
  •  北荒
    北荒 (楼主)
    2021-01-13 17:31

    Had the exact same issues with OVH/Kimsufi due to their custom kernel installed by default.

    First, you need to have first the regular ubuntu kernel and not one modified by your hosting company.

    Then, you need to disable transparent huge pages to remove the warning and improve memory performance related to memory management:

    1. Add this script as /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. Make the script executable sudo chmod 755 /etc/init.d/disable-transparent-hugepage

    3. Register it at boot sudo update-rc.d disable-transparent-hugepage defaults

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

提交回复
热议问题