'mongo db (mongodb.service) failed, status 14
I am experiencing the following problem using mongodb.
This is the error, when I check the status:
Screenshot of the error (mongodb.service, status 14)
Screenshot of code in the mongod.config file
I have tried uninstalling mongodb following every step from the website and install everything again and when I check the status I still get the same error. I have posted the screenshot of the error. I am using MacBook pro if this matters.
Would really appreciate, if someone can help me fix this.
Solution 1:[1]
By changing the owner to monogdb user of /var/lib/mongodb and /tmp/mongodb-27017.lock has worked for me.
sudo chown -R mongodb:mongodb /var/lib/mongodb
sudo chown mongodb:mongodb /tmp/mongodb-27017.sock
Solution 2:[2]
It seems from the log you have a unclean shutdown before. Or, it could also indicates that mongod is already running.
First, make sure mongod is not running already
ps aux | grep mongod
If it's not, remove the file:
rm /tmp/mongodb-27017.sock
Then try systemctl start mongod to start MongoDB again.
Solution 3:[3]
After rebooting in the command line,it fixed to problem,don’t know why after stopping mongo and uninstalling and installing it didn’t fix the problem, but after reboot everything is working fine.
Solution 4:[4]
This worked for me on Ubuntu 18.04
Go to the TMP directory: cd /tmp
Check if you have the mongodb sock file: ls *.sock
Change the user:group permission: chown mongodb:mongodb <YOUR_SOCK>
Start MongoDB: sudo service mongod start
Check the MongoDB status: sudo service mongod status
If this does not work you can try
sudo reboot
Please see here : https://medium.com/@gabrielpires/mongodb-ubuntu-16-04-code-exited-status-14-aws-lightsail-problem-417ffc78cb11
Solution 5:[5]
I had a similar issue and even though the permissions were all okay, the service failed to start. I had a look at the mongodb log
sudo tail -40 /var/log/mongodb/mongod.log
It said that the database was shutdown unexpectedly and needed to be repaired. I ran
sudo mongod --repair --config /etc/mongod.conf
This fixed the database, but now changed the permissions. You will need to do the chown steps again.
sudo chown -R mongodb:mongodb /var/lib/mongodb
sudo chown mongodb:mongodb /tmp/mongodb-27017.sock
Start the mongod service. It would be up & running now.
Solution 6:[6]
I have a similar issue. Was a SELinux blocking the normal execution. So, I did:
# ausearch -c 'mongod' --raw | audit2allow -M my-mongod
# semodule -X 300 -i my-mongod.pp
and then:
$ sudo systemctl start mongod
and check:
sudo systemctl status mongod
Solution 7:[7]
chown -R mongodb:mongodb /var/lib/mongodb chown mongodb:mongodb /tmp/mongodb-27017.sock
Solution 8:[8]
Same happended with CentOS Stream 8
the user for mongodb service is mongo and group is also mongo
sudo chown mongod:mongod /tmp/mongodb-27017.sock
Resolved, after checking the logfile, showing mongodb-27017.sock failed to start.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | |
| Solution 2 | WerWet |
| Solution 3 | Ivan C |
| Solution 4 | |
| Solution 5 | aByteCurious |
| Solution 6 | xilen0x |
| Solution 7 | M.Hakim |
| Solution 8 | Paul Bradbury |
