SuKhe
SuKhe

Reputation: 15

cannot start mongod for the website. "Unable to lock the lock file: /data/db/mongod.lock "

I am getting an error every time I try to run mongod over my system. I even tried killing the mongod process and then starting. Doesnt work. Following is the error: https://i.sstatic.net/NtPeS.png

Upvotes: 0

Views: 1205

Answers (1)

Adriano Martins
Adriano Martins

Reputation: 1808

That happens when the mongo didn't have a clean shutdown, so it is simply a forced shutdown + repair.

If you are using linux, just follow this instructions:

  • First make sure the mongo is not running: systemctl mongod stop
  • Remove the previous lock file: rm /data/db/mongod.lock
  • Run the mongod repair: mongod --repair
  • If needed, close the running mongod and restart the mongod: systemctl mongod start

Upvotes: 1

Related Questions