Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Mongodb not working on Ubuntu -> mongod.service: Failed with result 'exit-code'

Tags:

I installed mongodb following this tutorial here, no errors during the installation but when I try to start the mongod server using this command sudo systemctl start mongodb as the tutorial mentions, i getting this error when i try to check whether it is running using this command sudo systemctl status mongodb.

● mongodb.service - High-performance, schema-free document-oriented   database    Loaded: loaded (/etc/systemd/system/mongodb.service; enabled; vendor preset:     Active: failed (Result: exit-code) since Rab 2016-06-01 18:04:20 MYT; 4s ago   Process: 8241 ExecStart=/usr/bin/mongod --quiet --config /etc/mongod.conf (cod  Main PID: 8241 (code=exited, status=14)  Jun 01 18:04:20 yasinya systemd[1]: Started High-performance, schema-free docume Jun 01 18:04:20 yasinya systemd[1]: mongodb.service: Main process exited, code=e Jun 01 18:04:20 yasinya systemd[1]: mongodb.service: Unit entered failed state. Jun 01 18:04:20 yasinya systemd[1]: mongodb.service: Failed with result 'exit-co lines 1-10/10 (END) 

so can anyone tell what is wrong and how I can fix it.

like image 788
Yya09 Avatar asked Jun 01 '16 10:06

Yya09


People also ask

How do you check MongoDB is installed or not in Ubuntu?

MongoDB installs as a systemd service, which means that you can manage it using standard systemd commands alongside all other sytem services in Ubuntu. To verify the status of the service, type: sudo systemctl status mongodb.


1 Answers

Recently i have solved the same issue. I was unable to find the solution on googled, but i get come clues to, how get figure it out. In my case this issue was related to mongodb-27017.sock file.

Failed to unlink socket file /tmp/mongodb-27017.sock errno:1 Operation not permitted 

So i have changed the permission of /tmp/mongodb-27017.sock file to default mongodb user.

sudo chown mongodb /tmp/mongodb-27017.sock sudo chgrp mongodb /tmp/mongodb-27017.sock 

After this sudo systemctl status mongodb working fine and mongodb is started.

like image 179
Ranjeet Singh Avatar answered Oct 14 '22 10:10

Ranjeet Singh