6
votes
 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'.
1
Good practice is to check the logs first and find out the actual cause. Here is the log location /var/log/mongodb/Muhammad Tariq
You will find the answer here on StackoverflowMohamed Sabry

1 Answers

14
votes

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