Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Couldn't Start Mongo DB

Tags:

mongodb

ubuntu

 mongod.service - MongoDB Database Server
   Loaded: loaded (/lib/systemd/system/mongod.service; disabled; vendor preset: enabled)
   Active: failed (Result: exit-code) since Mon 2020-04-20 13:32:29 IST; 6min ago
     Docs: https://docs.mongodb.org/manual
  Process: 27917 ExecStart=/usr/bin/mongod --config /etc/mongod.conf (code=exited, status=14)
 Main PID: 27917 (code=exited, status=14)

Apr 20 13:32:29 manojkumar systemd[1]: Started MongoDB Database Server.
Apr 20 13:32:29 manojkumar systemd[1]: mongod.service: Main process exited, code=exited, status=14/n/a
Apr 20 13:32:29 manojkumar systemd[1]: mongod.service: Failed with result 'exit-code'.
like image 240
Manoj Kumar Julakanti Avatar asked Apr 20 '20 08:04

Manoj Kumar Julakanti


People also ask

Why MongoDB server is not starting?

We found that the reason for this error was the dbpath variable in /etc/mongodb. conf. Previously, the default value for dbpath was /data/db. The upstart job mongodb(which comes with mongodb-10gen package) invokes the mongod with –config /etc/mongodb.

Why is my MongoDB not connecting?

Ensure that your MongoDB instance is running: Compass must connect to a running MongoDB instance. Also check you have installed MongoDB and have a running mongod process. You should also check that the port where MongoDB is running matches the port you provide in the compass connect.

Why is mongod not working?

This error comes because after installing the MongoDB database we also need to set the path of MongoDB in the system environment variable. So to resolve this error you need to follow the below steps: Open that folder where you install MongoDB. Open MongoDB folder till bin folder where mongod.exe file and copy the path.

Why MongoDB is not installing?

Right-click on the setup and select Run as Administrator to install MongoDB using administrator rights. In case you cannot find an Administrative account on your PC, try to enable a hidden admin account. 1. Go to the Search bar to type in 'command prompt'.


Video Answer


2 Answers

It looks like mongo db fails to startup, usually it can be because the lack of permissions on mongodb's internal folders.

Try to check/set:

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

I've found the thread that talks about here

like image 167
Mark Bramnik Avatar answered Sep 29 '22 10:09

Mark Bramnik


To whoever comes here with the same problem of not able to start mongodb with the command (sudo systemctl status mongod) after successful installation:

I had to set ulimit -n 64000 to get it to work. This is actually mentioned in the installation docs here which I had ignored initially.

like image 21
hebbarp Avatar answered Sep 29 '22 11:09

hebbarp