I am totally a beginner with mac , I get this error while trying to open the server using mongod 10309 Unable to create/open lock file: /data/db/mongod.lock errno:13 Permission denied Is a mongod instance already running?, terminatin
4 Answers
The error usually indicates that the lock file is still present from a previous run. That means that the mongod process is stil running, check:
ps auxwww | grep mongod
If it is not listed, then remove the lock file and start mongod again. If it is listed and unresponsive you may have to kill the process (assuming you cannot connect). Try a regular kill before a kill -9 etc.
If the process is not there, or you kill it successfully, remove the lock file and restart mongod - if you had journaling enabled everything should be fine. If not, you may need the repair operation suggested by Sean.
Do you have journalling enabled? If not, and your mongod instance crashed, then you may need to perform a recovery. In this case, what you should do is
- start mongod with the repair switch:
mongod --repair
. It will run, and then terminate having deleted the lock file. - start mongod again normally.
Once you do this, I highly recommend that you enable journalling by using the --journal
command line switch when you start mongod.