Uploaded image for project: 'Core Server'
  1. Core Server
  2. SERVER-25961

mongo 3.2.9 doesn't start with chkconfig on Centos 7

    • Type: Icon: Bug Bug
    • Resolution: Cannot Reproduce
    • Priority: Icon: Minor - P4 Minor - P4
    • None
    • Affects Version/s: 3.2.9
    • Component/s: Packaging
    • Labels:
      None
    • Fully Compatible
    • ALL
    • Hide

      change config file name
      change default directories and pid file name
      give permission to mongod to the paths
      add service mongod_dr to chkconfig

      Show
      change config file name change default directories and pid file name give permission to mongod to the paths add service mongod_dr to chkconfig
    • Evergreen 2016-10-31

      Hi,
      I setted up a replicaset on Centos 7 and I am facing issue with permission and automatic restart after a reboot.
      This is an extract of the config which I named mongod_dr:

      systemLog:
        destination: file
        logAppend: true
        path: /log/mongo/DR/mongo.log
      
      # Where and how to store data.
      storage:
        dbPath: /data/mongo/DR
        journal:
          enabled: true
      #  engine:
      #  mmapv1:
      #  wiredTiger:
      
      # how the process runs
      processManagement:
        fork: true  # fork and run in background
        pidFilePath: /var/run/mongodb/mongod_dr.pid  # location of pidfile
      
      # network interfaces
      net:
        port: 27017
      

      and this the extract of the associated init.d script /etc/initd./mongod_dr:

      # NOTE: if you change any OPTIONS here, you get what you pay for:
      # this script assumes all options are in the config file.
      CONFIGFILE="/etc/mongod_dr.conf"
      OPTIONS=" -f $CONFIGFILE"
      SYSCONFIG="/etc/sysconfig/mongod"
      
      PIDFILEPATH=`awk -F'[:=]' -v IGNORECASE=1 '/^[[:blank:]]*(processManagement\.)?pidfilepath[[:blank:]]*[:=][[:blank:]]*/{print $2}' "$CONFIGFILE" | tr -d "[:blank:]\"'" | awk -F'#' '{print $1}'`
      
      mongod=${MONGOD-/usr/bin/mongod}
      
      MONGO_USER=mongod
      MONGO_GROUP=mongod
      

      I also already setted up chkconfig:

      mongod_dr       0:off   1:off   2:off   3:on    4:off   5:on    6:off
      

      I also already change the permission for the user mongod to all the involved paths, but what is happening is that after the reboot it doesn't start and even with the command:

      sudo service mongod_dr start
      

      the only way to start is this:

      /usr/bin/mongod -f /etc/mongod_dr.conf
      

      Is there anyway to fix this?what am i doing wrong?

      Regards,
      Carlo Alberto

            Assignee:
            sam.kleinman Sam Kleinman (Inactive)
            Reporter:
            karl_sg@hotmail.it Carlo Alberto Scaglia
            Votes:
            0 Vote for this issue
            Watchers:
            6 Start watching this issue

              Created:
              Updated:
              Resolved: