Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Mongod Error: 98 Unable to lock file: /data/db/mongod.lock Resource temporarily unavailable. Is a mongod instance already running?


2017-06-12T13:06:18.407+0300 I STORAGE [initandlisten] exception in initAndListen: 98 Unable to lock file: /data/db/mongod.lock Resource temporarily unavailable. Is a mongod instance already running?, terminating
2017-06-12T13:06:18.407+0300 I NETWORK [initandlisten] shutdown: going to close listening sockets...
2017-06-12T13:06:18.407+0300 I NETWORK [initandlisten] shutdown: going to flush diaglog...
2017-06-12T13:06:18.407+0300 I CONTROL [initandlisten] now exiting
2017-06-12T13:06:18.407+0300 I CONTROL [initandlisten] shutting down with code:100

like image 561
Zainab Hammami Avatar asked Nov 28 '22 13:11

Zainab Hammami


1 Answers

The error clearly says

exception in initAndListen: 98 Unable to lock file: /data/db/mongod.lock Resource temporarily unavailable. Is a mongod instance already running?, terminating

An instance of mongod is already running and it held a lock on mongod.lock file. Run ps -eaf | grep mongod to find the running instance. If running, kill the process sudo kill <pID> obtained from above grep command.

Then delete the mongod.lock file as mongod wasn't shutdown gracefully. Post deleting the lock file start the mongod process sudo mongod.

Hope this helps!

like image 82
harshavmb Avatar answered Feb 17 '23 15:02

harshavmb