Unable to lock the lock file: /data/db/mongod.lock. Another mongod instance is already running on the /data/db directory, terminating

11/27/2018

I trying to run mongodb statefulset with three replicas in kubernetes using nfs persistence storage. Out of three pods mongo-0 pod is in running and another two pods are showing CrashLoopBackOff. I saw the logs of those two pods and getting the error like

2018-11-27T21:38:18.581+0000 I STORAGE [initandlisten] exception in initAndListen: DBPathInUse: Unable to lock the lock file: /data/db/mongod.lock (Unknown error). Another mongod instance is already running on the /data/db directory, terminating

Here the link for my pv, pvc and mongodb statefulset files.

Could anybody suggest me on this issue?

-- gayathri
kubernetes
mongodb
nfs

1 Answer

11/28/2018

kill mongod processes in ubuntu sudo killall -9 mongod or

ps -aux|grep mongo kill -9 [PID] PID of mongod

-- vimal
Source: StackOverflow