How can I clear the mongoDB oplog?

Why mongodb is locked?

  • Hey folks, my development pc is 32 bit. and I work with mongodb. When I run the code I wrote, sometimes I get locked in MongoDB. I deleted from the file the problem solved. /var/lib/mongodb/mongod.lock So I always have to do it? Why MongoDB crashes?

  • Answer:

    If mongodb is running and improper shutodown happens, then this problem appears. You can repair it by trying one of the following commands: 1. mongod --repair 2. mongod --dbpath /data/db --repair --repairpath /data/db 3. mongod --dbpath /data/db or from console(if service is running but db is corrupted ) > db.repairDatabase();

Jayant Gs at Quora Visit the source

Was this solution helpful to you?

Other answers

The lock file is used to detect improper crashes. Why don't you run with Journalling enabled so that you don't have to worry about the lock file. However I think in your case it will be better to find out why Mongodb is "freezing" in the first place. Look at /var/log/mongo/mongod.log - it might help

Dharshan Rangegowda

Related Q & A:

Just Added Q & A:

Find solution

For every problem there is a solution! Proved by Solucija.

  • Got an issue and looking for advice?

  • Ask Solucija to search every corner of the Web for help.

  • Get workable solutions and helpful tips in a moment.

Just ask Solucija about an issue you face and immediately get a list of ready solutions, answers and tips from other Internet users. We always provide the most suitable and complete answer to your question at the top, along with a few good alternatives below.