Installation of MongoDB in Pseudo Distributed cluster ( Linux )

Hi MongoDBlistners,

This material is providing you some information about the installation of MongoDB pseudo cluster in a Linux environment. Just ten step will give you a mongodb pseudo cluster in your machine. Install MongoDB and start processing it.


What is mongod ?
mongod is the primary daemon process for the MongoDB system. It handles data requests, manages data format, and performs background management operations. This document provides a complete overview of all command line options for mongod. These options are primarily useful for testing purposes.

1. Download
Use below link to download MongoDb or if you want to download the latest version of MongoDB then check its official web Site


2. Extract MongoDb
After downloading untar mongodb use the below command to untar it.
$tar -zxvf mongodb-linux-x86_64-2.4.8.tgz

3. Reload local package database
We need to update the apt-get in your system because we will use it to download the mongodb dependencies so lets update it using below command
$sudo apt-get update

4. Install the mongodb server
After updating apt-get, we need to install mongodb server. Use below command to install mongodb-server using software center
$sudo apt-get install mongodb-server

5. Create a directory for MongoDB
Now we need to create some directories which are need for mongodb. This folder created will be used by mongodb to store the physical block.
$sudo mkdir /data
$sudo mkdir /data/db

6. Change the mod of permission for mongodb
Now change permissions for the folder that are created manually.
$sudo chmod -R 777 /data/*

7. Enter in to mongodb folder
Now lets enter in to mongodb to start and to process mongodb
$cd mongodb-linux-x86_64-2.6.0

8. Start the mongod and mongo
Now lets start mongodb use the below command. First command “bin/mongod” will start mongodb daemon. Second command “bin/mongo” will open you the mongodb shell.
$mongo localhost:27017



Process Queries in MongoDb
switch to given database use <database>
List the available databases show dbs
List the available collections show collections
List the available commands and help help
Create a Collection db.createCollection(“datadotz”, { size: 1048576 } )
Show the collections show collections
Delete a Collection db.getCollection(“datadotz”).drop()
To know what database we are using db
Inserting into a database db.employee.insert({pid:’1′,name:’alex’,drug:’avil’,tot_amt:100})
Display all the details in the database db.test.find()


Article written by DataDotz Team

DataDotz is a Chennai based BigData Team primarily focussed on consulting and training on technologies such as Apache Hadoop, Apache Spark , NoSQL(HBase, Cassandra, MongoDB), Search and Cloud Computing.

Note: DataDotz also provides classroom based Apache Kafka training in Chennai. The Course includes Cassandra , MongoDB, Scala and Apache Spark Training. For more details related to Apache Spark training in Chennai, please visit