Follow the steps from mongodb official site for installation of mongodb .Here I will talk about mongodb 2.4 for ubuntu 12.04 and we will keep our database file in the Amazon EC2 EBS(Amazon Elastic Block Store) volume.
Create the data directory in the attached ebs volume . By default mongo expects it to be at /var/lib/mongodb. To create a folder you can use the command(s).
sudo mkdir EBS_VOL_path/mongodb
sudo mkdir EBS_VOL_path/mongodb/db
Now we have to locate the mongodb configuration file mongodb.conf. It is located in /etc directory of root . Then open the configuration(mongodb.conf) file change the db path.
like this
dbpath= /media/ebs/mongodb/db
Change the permission of the directory. So that mongodb default user can have the access to it.
0 Comment(s)