M ongo DB is the Open-source Database Management system(DBMS), It is also the non-relational database, NoSQL database. It stores the data as...
Mongo DB is the Open-source Database Management system(DBMS), It is also the non-relational database, NoSQL database.
It stores the data as documents, Instead of rows and columns.
The Document storage function format is called BSON, where the binary style of JSON File Format.
Step1: To Add the Mongo DB repositories in Local:
Adding the MongoDB repositories (MongoDB-org) to our servers (it is not the default repositories in centos, so adding to the local server).
Command: sudo vi /etc/yum.repos.d/mongodb-org.repo
Adding the repo name as mongodb-org.repo inside etc/yum.repos.d directory.
yum.repos.d is a directory, which is used to store the new or existing repositories in our server locally.
Step2:
pasting the MongoDB repositories information in /etc/yum.repos.d/mongodb-org.repo.
[mongodb-org-3.4]
name=MongoDB Repository
baseurl=https://repo.mongodb.org/yum/redhat/$releasever/mongodb-org/3.4/x86_64/
gpgcheck=1
enabled=1
gpgkey=https://www.mongodb.org/static/pgp/server-3.4.asc
[mongodb-org-4.0]
name=MongoDB Repository
baseurl=https://repo.mongodb.org/yum/redhat/$releasever/mongodb-org/4.0/x86_64/
gpgcheck=1
enabled=1
gpgkey=https://www.mongodb.org/static/pgp/server-4.0.asc
[mongodb-org-4.2]
name=MongoDB Repository
baseurl=https://repo.mongodb.org/yum/redhat/$releasever/mongodb-org/4.2/x86_64/
gpgcheck=1
enabled=1
gpgkey=https://www.mongodb.org/static/pgp/server-4.2.asc
[mongodb-org-4.4]
name=MongoDB Repository
baseurl=https://repo.mongodb.org/yum/redhat/7Server/mongodb-org/4.4/x86_64/
gpgcheck=1
enabled=1
gpgkey=https://www.mongodb.org/static/pgp/server-4.4.asc
Step3:
checking the MongoDB exists within the yum utility repolist command displays all enabled repositories.
yum repolist
Step4: Install the mongodb.org, start, reload and check the status of the server.
Commands:
sudo yum -y install mongodb-org
sudo systemctl start mongod
sudo systemctl status mongod
To stop the Mongo server.
Command: sudo systemctl stop mongod
Step5: Checking the mongo installed version
After installing the Mongo DB server need to check the version here Installed version was 4.4.
Command: mongod --version
To Check the Mongod Running status using the Netstat command.
Command: netstat -antup | grep -i 27017