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

mongodbterminal


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

Best Answer

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!

Related Topic