MongoDB Installation, Configuration, and Advantages

MongoDB is a No SQL database. It is an open-source, cross-platform written in C++. It does not support Structured Query Language (SQL) to manipulate or retrieve stored data. It stores data in a document structure instead of storing data in tables. This is similar to JSON.

Installation

1) Add MongoDB repository.

Change the directory to repos.d directory.

# cd /etc/yum.repos.d

create file for MongoDB

# vi mongodb.repo

Add the following lines to the file mongodb.repo

[mongodb]

name=MongoDB Repository

baseurl=http://downloads-distro.mongodb.org/repo/redhat/os/x86_64/

gpgcheck=0

enabled=1

 

2) Install MongoDB.

# yum repolist

# yum -y install mongodb-org

# service mongod start

 

3) Check MongoDB Service Status.

# service mongod status

 

4) To check installed mongodb version.

# mongod –version

 

5) To check proper working of MongoDB

# mongo

 

To create a MongoDB administrator user

1) Open mongoDB shell

# mongo

 

2) switch to database ‘admin’

> use admin

 

3) Type the below query to create a user:

> db.createUser(

{

user: “admin”,

pwd: “123admin”,

roles: [ { role: “userAdminAnyDatabase”, db: “admin” } ]

}

)

 

4) To view the created user:

  > show users

{

“_id”: “admin.admin”,

“user” : “admin”,

“db” : “admin”,

“roles” : [

{

“role” : “userAdminAnyDatabase”,

“db” : “admin”

}

]

}

>

 

 Advantages

1) Document based data model.

2) Easy to scale.

3) It supports the common authentication mechanisms, such as LDAP, AD, and certificates.

4) MongoDB can be a cost-effective solution by  increasing flexibility and reducing cost on hardware and storage.

5) Deep query-ability.

6) Provides high performance data persistence.

7) Support embedded data models and reduces I/O activity on database system.

 

Where to Use MongoDB?

1) User Data Management: It ensures that the items that users create, such as personal files and documents.

2) Big data: It is a collection of large data sets that cannot be processed using traditional computing techniques.

3) Content Management and Delivery: It is a computer application that supports the creation and modification of digital content.

4) Mobile and Social Infrastructure

5) Data Hub: It is a database which is populated with data from one or more sources and from which data is taken to one or more destinations.

 

If you need any further assistance please contact our support department.

Was this answer helpful? 0 Users Found This Useful (0 Votes)