mongodb.lock permission denied
I verified /etc/rc.d/mongodb, and I think it will use mongodb user to run the service:
[ -z "$PID" ] && /bin/su mongodb -c "/usr/bin/mongod --config /etc/mongodb.conf --fork" > /dev/null
I think this error may caused by run mongod using root, so the owner of the mongod.lock is changed to root.
I can start a MongoDB instance by mongod, but not in the background as above
When you start mongod
this way are you actually starting it with all of the same parameters? The lock file is only for that specific folder.
Things to check:
- Is there already an instance of
mongod
running (ps -ef | grep mongod
)? - Is there something else running on that port?
- Are you configs correct? Why do you have the
--journal
command, shouldn't this be--nojournal
in v2.0+ or simply nothing?