1

I am installing the mongodb with the default configurations, and that gets started normally, but when I changed the dbpath value to point to different position it started giving me the exceptions, can some one help me and tell me where I am doing the mistake,

Here is my /etc/mongod.conf file that is I am changing,

enter image description here

Here is what I getting the output when trying to start the mongodb

enter image description here

Here is my mongodb logs from /var/log/mongo/mongod.log

enter image description here

here is my /ebs/mongo/ and /ebs/mongo/db permissions

enter image description here

here is strace of service start mongod (its pretty big :( )

strace -f service mongod start > test.txt

I have really no clue what is going on here :(, please shed some light... Thanks in advance

  • 1
    By any chance, your mongod service does not run as root, does it ? Look into /etc/init/mongod.conf and show us the money :) – Oct Mar 10 '14 at 17:23
2

Your db folder is owned by root:root and you should not be running MongoDB as root. If you are using the MongoDB defaults (you don't mention what flavor of Linux you are using), then the service will either start as the mongod or mongodb user, not root, which is the correct behavior.

Hence, when the mongod process tries to create/use the mongod.lock file you get a permissions error. You need to change the permissions of /ebs/mongo/db appropriately. That can be done with one of the following commands (as root, or with sudo):

chown -R mongodb:mongodb /ebs/mongo/db

Or:

chown -R mongod:mongod /ebs/mongo/db

You will also want to make sure that whatever logpath you use can be written by the same user. I've basically answered this one before on StackOverflow with a slightly different cause, so have a look there also.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.