Mongodb – Mongo crash after 2 seconds of starting

mongodbmongodb-3.0

My mongod service crashes within 2-5 seconds of starting. I don't understand why.

Here are the systemctl logs:

systemctl status mongod.service

mongod.service - High-performance, schema-free document-oriented database
Loaded: loaded (/usr/lib/systemd/system/mongod.service; enabled; vendor preset: disabled)
Active: failed (Result: exit-code) since Thu 2016-05-05 11:43:57 UTC; 4min 40s ago
Process: 7597 ExecStart=/usr/bin/mongod $OPTIONS run (code=exited, status=0/SUCCESS)
Main PID: 7601 (code=exited, status=14)

May 05 11:43:52 database13.choozon.net systemd[1]: Starting High-performance, schema-free document-oriented database...
May 05 11:43:52 database13.choozon.net mongod[7597]: warning: bind_ip of 0.0.0.0 is unnecessary; listens on all ips by default
May 05 11:43:52 database13.choozon.net mongod[7597]: about to fork child process, waiting until server is ready for connections.
May 05 11:43:52 database13.choozon.net mongod[7597]: forked process: 7601
May 05 11:43:54 database13.choozon.net systemd[1]: Started High-performance, schema-free document-oriented database.
May 05 11:43:57 database13.choozon.net systemd[1]: mongod.service: Main process exited, code=exited, status=14/n/a
May 05 11:43:57 database13.choozon.net systemd[1]: mongod.service: Unit entered failed state.
May 05 11:43:57 database13.choozon.net systemd[1]: mongod.service: Failed with result 'exit-code'.

So far I have:

  • checked permissions (everything looks good)
  • checked the service
  • tried deleting mongo.lock

mongod appears to start without any errors, but then fails after a couple of seconds.

Any ideas ?

Best Answer

Search for mongod.lock and remove it and restart the service.

  1. Find out the Mongo data path cat /etc/mongod.conf | grep dbPath
  2. Look for mongod.lock file in it.
  3. If its there then delete the file and restart the server.