I recently installed mongo 2.6.5 version on our Red Hat enterprise Linux server. Everything was working fine, until I decided to make a change in /etc/mongod.conf file. I noticed that from version 2.6 above mongo supports conf file in YAML fomat. (the reason I wanted to make a change was, I wanted to enable the authentication on mongo instance)
http://docs.mongodb.org/manual/reference/configuration-options/
I changed my config file which used to look like below (I am adding only a portion of the config):
# mongod.conf
#where to log
logpath=/var/log/mongodb/mongod.log
logappend=true
# fork and run in background
fork=true
#port=27017
dbpath=/var/lib/mongo
# location of pidfile
pidfilepath=/var/run/mongodb/mongod.pid
My changed file mongod.conf file looks like below now:
systemLog:
destination: file
path: "/var/log/mongodb/mongodb.log"
logAppend: true
storage:
dbPath: "/var/lib/mongo"
journal:
enabled: true
processManagement:
pidFilePath: "/var/run/mongodb/mongod.pid"
fork: true
security:
authorization: true![enter image description here][1]
Now when I try to run the mongod service it is giving me error (see attached picture): dirname: missing operand Try 'dirname --help' for more information Starting mongod: [FAILED]
When I revert my mongod.conf file to previous version, then the service runs fine. Do I need to change something in my mongo installation to make it use YAML format of config?
A few things:
make sure that you define a PID file location in /etc/mongod.conf
pidfilepath=/var/run/mongodb/mongod.pid
change the "daemon" line in /etc/init.d/mongod to explicitly use the PID file
daemon --user "$MONGO_USER" --check "$mongod" --pidfile "$PIDFILE" "$NUMACTL $mongod $OPTIONS >/dev/null 2>&1"
In addition, ensure that the following are all owned by mongod
It would seem that although mongod supports YAML config files, the initscripts haven't been revised to handle them.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With