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?
Install MongoDB On Windows The default location for the MongoDB data directory is c:\data\db. So you need to create this folder using the Command Prompt.
Copy the data folder of your mongodb to the new location - cp -R /var/lib/mongodb/ /mnt/database/ Remove the old database folder - rm -rf /var/lib/mongodb/ Create symbolic link to the new database folder - ln -s /mnt/database/mongodb /var/lib/mongodb.
The default dbpath for mongodb is /data/db .
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
).
The easiest would be
sudo chmod 777 /data/db
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With