10
 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'.

2 Answers2

25

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

Mark Bramnik
  • 39,963
  • 4
  • 57
  • 97
  • your suggestion worked perfectly. I had initially installed mongodb on WSL/Debian11 over 5 weeks ago and just now getting to use it. During that install, I had forgot to change the user/group. – Energetic Pixels Jul 16 '23 at 13:16
1

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.

hebbarp
  • 11
  • 4