Skip to content

Instantly share code, notes, and snippets.

@tasdikrahman
Last active March 2, 2016 16:13
Show Gist options
  • Save tasdikrahman/a73f08b112ec7b627070 to your computer and use it in GitHub Desktop.
Save tasdikrahman/a73f08b112ec7b627070 to your computer and use it in GitHub Desktop.
MongoDB starting problem in Ubuntu

You started mongodb server, but No matter what. However, when you run sudo status mongodb again, you’ll get mongodb stop/waiting instead of mongodb start/running

Note: This condition is largely due to an unclean shutdown, and results in the creation of a lockfile /var/lib/mongodb/mongod.lock

The fix is a quick two-step process as follows:

Remove the lockfile. Run the repair script. This is accomplished as follows:

$ sudo rm /var/lib/mongodb/mongod.lock
$ sudo -u mongodb mongod -f /etc/mongodb.conf --repair

Now when you run sudo start mongodb. It will report

mongodb start/running, process XXXX

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment