Tuesday 10 November 2015

Install MongoDB on Ubuntu 14.04

 Install MongoDB on Ubuntu 14.04


In modern web applications, the major issue arises with managing data, since its growth rate is almost exponential. To handle this situation you need a scalable database. MongoDB is a scalable, open source, high performance, document oriented database. MongoDB falls under the broader category called NoSQLb databases. This post focuses on how to install MongoDB and the Next post is about How to take backup of MongoDB database and store it to S3.

Lets start with the Installation process. First you are required to have machine with Ubuntu 14.04 LTS (Long Term Services) installed. Now go with following steps:
  1. Import Public Key
    This step will import the MongoDB GPG public key. This step is required for authenticity of software packages by verifying that they are signed with GPG keys.
    So run:
    sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv 7F0CEB10
    

  2. Create a List File
    To inform APT, from where to download the packages, you will need to add MongoDB repository details. Following command will create a list for MongoDB.
    Run:
    echo "deb http://repo.mongodb.org/apt/ubuntu "$(lsb_release -sc)"/mongodb-org/3.0 multiverse" | sudo tee /etc/apt/sources.list.d/mongodb-org-3.0.list
    

  3. Update Package list
    After adding the repository details, you are required to update the packages list.
    So run:
    sudo apt-get update
    

  4. Install MongoDB
    Now, you are ready to install MongoDB. Following command will install latest stable version of MongoDB and other helpful management tools required for MongoDB server.
    Run:
    sudo apt-get install -y mongodb-org
    

  5. Verify
    Above command will start MongoDB automatically. To check run:
    service mongod status
    

    you will get mongod running status with process ID.

Some useful command for MongoDB:
  1. To start MongoDB:
    service mongod start
    

  2. To stop MongoDB:
    service mongod stop
    

  3. To restart MongoDB:
    service mongod restart
    

Congratulations! You have installed MongoDB.

Backups

If you are worried about backups than mongodump is the solution. Here is the complete way to take backup of mongodb and store it to S3 with a cron.
 
References:
  1. http://irohinichoudhary.blogspot.in/2015/01/mongodb.html

0 comments:

Post a Comment

 

Copyright @ 2013 Appychip.

Designed by Appychip & YouTube Channel