Sunday, 14 January 2018

Mongo DB - Installation and Configuration

MongoDB  is an open-source document database, and the leading NoSQL database. Written in C++.
MongoDB features:
    Document-Oriented Storage
    Full Index Support
    Replication & High Availability
    Fast In-Place Updates

Reduce cost, accelerate time to market, and mitigate risk with proactive support and enterprise-grade capabilities.

Today, We will see how to install and run the MongoDB.

MongoDB Installation on Linux

1. DOWNLOAD the stable version of MongoDB. It will a tar file
2. Extract the tar file to some directory.
$ tar -xvf mongodb.tar -C /learn/mongodb

3.  change the permisson of folder to user who run the db here-  In my case User - hduser and Group - hadoop
$ chown -R hduser:hadoop /learn/mongodb

4. Add the env var in .bashrc
export MONGO_HOME=/learn/mongodb

5. Create the default DB directory for Mongo
$ mkdir -R /data/db
$ chown -R hduser:hadoop /data/db

This is by default, you can specify ur db path when starting the mongo db

$ mongod --dbpath /app/mongodata
this command will start the mongodb. in other terminal you can start work on db. "--dbpath /app/mongodata" is totally optional

If you just use just $ mongod , it will start n use the default db which we have defined in step 5.

Please don't close the current terminal, It can be kill the mongodb process.

6. Start working on MongoDB
$ mongo

Like the below page to get update