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
Mongodb – Mongod Error: 98 Unable to lock file: /data/db/mongod.lock Resource temporarily unavailable. Is a mongod instance already running
mongodbterminal
Best Answer
The error clearly says
An instance of mongod is already running and it held a lock on
mongod.lock
file. Runps -eaf | grep mongod
to find the running instance. If running, kill the processsudo 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 processsudo mongod
.Hope this helps!