Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Unable to change the dbpath in mongodb through mongodb.conf

I am getting the following message
exception in initAndListen std::exception: boost::filesystem::exists: Permission denied: "/vol/mongodb", terminating

in /var/log/mongodb/mongodb.log

ls -al /vol/mongodb gives -
drwxrwxrwx 2 mongodb mongodb 4096 2011-08-07 12:10 ./

When I change the dbpath, back to the default, which is /var/lib/mongodb - it works fine.

How do I solve this?

like image 965
zubinmehta Avatar asked Aug 07 '11 08:08

zubinmehta


People also ask

Where is dbPath MongoDB?

By default, MongoDB listens for connections from clients on port 27017 , and stores data in the /data/db directory. On Windows, this path is on the drive from which you start MongoDB. For example, if you do not specify a --dbpath , starting a MongoDB server on the C:\ drive stores all data files in C:\data\db .

What does mongod command do?

The main purpose of mongod is to manage all the MongoDB server tasks. For instance, accepting requests, responding to client, and memory management. mongo is a command line shell that can interact with the client (for example, system administrators and developers).


1 Answers

I had the same problem initially and found it was caused by the mongodb user not having appropriate permissions on the parent directory.

I'd recommend checking /vol to ensure that the mongodb user can at least read files from that directory. May also need execute permissions too, and I suspect this will hold for each subsequent parent directory up to root.

like image 96
scttl Avatar answered Sep 27 '22 21:09

scttl