Join the social network of Tech Nerds, increase skill rank, get work, manage projects...
 
  • Change the default database file location of mongodb

    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 486
    Comment on it
    1. 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.

    2. 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
    1. 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
    2. Change the permission of the directory. So that mongodb default user can have the access to it.
      sudo chown -R mongodb:mongodb /media/ebs/mongodb/db
    3. Restart
      sudo service mongodb restart 
      and run mongo.

 0 Comment(s)

Sign In
                           OR                           
                           OR                           
Register

Sign up using

                           OR                           
Forgot Password
Fill out the form below and instructions to reset your password will be emailed to you:
Reset Password
Fill out the form below and reset your password: