Mongodb data directory permissions

mongodb

Earlier i was storing all the mongodb data files in /var/lib/mongodb directory..and the dbpath entry in /etc/mongodb.conf was /var/lib/mongodb..

Now i want to change the data directory to /vol/db..so I created the directory /vol/db and changed the permissions using sudo chown -R id -u /vol/db and changed the db path entry to /vol/db in /etc/mongodb.conf

now when i start the mongodb using sudo service mongodb start..i am getting this error in /var/log/mongodb/mongodb.log

http://pastebin.com/C0tv8HQN

i need help..where I am wrong?

Best Answer

I was having the same problem, but was able to solve it thanks to a similar question. You need to make sure that /vol/db/ is owned by mongodb.

sudo chown -R mongodb:mongodb /vol/db/

If you get the error chown: invalid user: 'mongodb:mongodb', check /etc/passwd to see if there is a similar user that exists (ex. mongod).

Related Topic