Recovering from MongoDB crashes on ubuntu or windows

Posted By : Akash Sharma | 01-May-2013

Sometimes during development  with MongoDB I have experienced that MongoDB crashes  , In this blog I am sharing how to recover from a crashed MongoDB instance.

First I am going to show steps in windows OS:

There is a file named “mongod.lock” in C:\data\db directory.

First you need to delete this file.

Then you need to restart mongodb by applying following command in command prompt with administrative priviledges:

net start MongoDB

 

 

Now I am going to show steps in Ubuntu OS:

There is a file named “mongod.lock” in /var/lib/mongodb directory.

You need to delete this file by the following command:

sudo rm  -f  /var/lib/mongodb/mongod.lock

 

Then you need to restart mongodb by applying following command in terminal:

sudo service mongodb start

 

 

Akash Sharma

[email protected]

 

About Author

Author Image
Akash Sharma

Akash is a bright Groovy and Grails developer and have worked on development of various SaaS applications using Grails technologies. Akash loves playing Cricket and Tennis

Request for Proposal

Name is required

Comment is required

Sending message..