Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is the use of the mongo.lock file?

Tags:

mongodb

I am using mongodb-v1.8.1. Unfortunately my server gets hanged and i restarted my server.Once it comes back i could-not start the MongoDB. I removed the mongo.lock file and ran repair database query.Now mongo working fine. I am baffled with the mongo.lock file.What is the use of the mongo.lock file?.Removing the mongo.lock file will affect my existing data? Please let me know your suggestion..

Thanks,

like image 483
kumar_88 Avatar asked Jul 28 '11 10:07

kumar_88


1 Answers

Mongodb always creates the mongodb.lock file when the server starts and drops it before mongodb is stopped.

Removing mongodb.lock does not affect any data it just means that mongodb was not stopped correctly. So, you are correct in removing this file and running with the -repair option should fix database.

like image 187
Andrew Orsich Avatar answered Oct 04 '22 18:10

Andrew Orsich