MongoDB: ERROR: child process failed, exited with error number 14
You started and probably shutdown mongo in the wrong way.
1. TO START MONGODB
To start mongo in the background type: mongod --dbpath /data/db --fork --logpath /dev/null
.
/data/db
is the location of the db. If you haven't created one yet => type:mkdir /data/db
--fork
means you want to start mongo in the background - deamon.--logpath /dev/null
means you don't want to log - you can change that by replacing/dev/null
to a path like/var/log/mongo.log
2. TO SHUTDOWN MONGODB
Connect to your mongo by typing: mongo
and then use admin
and db.shutdownServer()
. Like explain in mongoDB
If this technique doesn't work for some reason you can always kill the process.
- Find the mongodb process
PID
by typing:lsof -i:27017
assuming your mongodb is running on port 27017 - Type
kill <PID>
, replace<PID>
by the value you found the previous command.
For me it was ulimit
issue, mongo could not open too many files.
Used ulimit -n 10000
.
However as a generic pointer look into mongo logs file, they will tell where to look further. Generally the logs file are in /var/log/mongo.log
but look into your mongo config file.
It's because you haven't configured your mongod
instance correctly in the config file that you passed to the -f
option.
Revisit your config file and make sure eveything is configured correctly.
Check the ownership of the file /tmp/mongodb-27017.sock
It should be mongod
. I got same error since it was root:root