GICT knowledge base
MongoDB Installation, Configuration, and Advantages
Published
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.
Related guides
How to Restrict an SSH Key to One Command
Restrict an SSH key to one command with authorized_keys options. Protect the command and check that unwanted shell and forwarding access are denied.
Linux and CommandsSelf-Hosted Video Processing With FFmpeg: A Practical Guide
Learn how to self-host video processing on a VPS using FFmpeg, with practical commands for conversion, compression, thumbnails, and automated workflows.
Linux and CommandsHow to use nohup: Commands in Linux That Survive Terminal Closes
Keep commands running after you close the terminal. nohup examples with wget, Python, rsync, and Docker on any VPS.
Linux and CommandsHow to Fix “Too Many Open Files” Error on Linux Servers
Learn how to fix the "Too Many Open Files" error on Linux servers by understanding file descriptors, adjusting limits, and diagnosing leaks effectively.
