Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

MongoDB.service failed with result exit-code

Tags:

mongodb

bdd

I can't start mongoDB with the command "sudo systemctl start mongod".

I'm getting the following message :

● mongod.service - MongoDB Database Server
   Loaded: loaded (/lib/systemd/system/mongod.service; enabled; vendor preset: enabled)
   Active: failed (Result: exit-code) since Wed 2020-02-19 22:39:00 CET; 2s ago
     Docs: https://docs.mongodb.org/manual
  Process: 29368 ExecStart=/usr/bin/mongod --config /etc/mongod.conf (code=exited, status=14)
 Main PID: 29368 (code=exited, status=14)

Feb 19 22:39:00 pop-os systemd[1]: Started MongoDB Database Server.
Feb 19 22:39:00 pop-os systemd[1]: mongod.service: Main process exited, code=exited, status=14/n/a
Feb 19 22:39:00 pop-os systemd[1]: mongod.service: Failed with result 'exit-code'.

I've already reinstalled mongodb and I having the same problem. I don't know where the error came from if you can help me. Thank you.

like image 681
Donastien Avatar asked Feb 19 '20 21:02

Donastien


People also ask

Where is MongoDB Service file?

By default, MongoDB listens for connections from clients on port 27017 , and stores data in the /data/db directory. On Windows, this path is on the drive from which you start MongoDB. For example, if you do not specify a --dbpath , starting a MongoDB server on the C:\ drive stores all data files in C:\data\db .


3 Answers

Just do those two commands for temporary solution:

sudo rm -rf /tmp/mongodb-27017.sock
sudo service mongod start

For details:

That shall be fault due to user permissions in .sock file, You may have to change the owner to monogdb user.

sudo chown -R mongodb:mongodb /var/lib/mongodb
sudo chown mongodb:mongodb /tmp/mongodb-27017.sock

For more details visit Documentation for installation

like image 50
Mohamed Sabry Avatar answered Oct 09 '22 06:10

Mohamed Sabry


I had the same problem in Manjaro and these commands solved it:

chown -R mongodb:mongodb /var/lib/mongodb
chown mongodb:mongodb /tmp/mongodb-27017.sock
like image 44
HosseinNedaee Avatar answered Oct 09 '22 04:10

HosseinNedaee


This worked for me and I don't reinstall MongoDB. I have created manually

sudo mkdir /var/lib/mongodb
sudo mkdir /var/log/mongodb

and changed owner for both

sudo chown -R mongodb:mongodb /var/lib/mongodb
sudo chown -R mongodb:mongodb /var/log/mongodb
like image 19
MD RAKIBUL ISLAM RAKIB Avatar answered Oct 09 '22 06:10

MD RAKIBUL ISLAM RAKIB