Introduction to NoSQL and MongoDB Installation on CentOS 7
This article explains the concepts and advantages of NoSQL databases, categorizes the four main types, introduces MongoDB’s data model and components, and provides step‑by‑step instructions for installing MongoDB 7.0 on CentOS 7 using both yum repository and manual RPM packages.
NoSQL, short for "Not Only SQL", refers to non‑relational databases that have grown beyond the traditional SQL scope.
Compared with relational databases, NoSQL stores data in non‑tabular forms and offers several advantages:
Flexible data models
Horizontal scalability suitable for massive data storage
Fast retrieval without JOIN operations
Developer‑friendly
Non‑relational databases are generally divided into four categories:
Document databases
Key‑value stores
Wide‑column (wide‑table) databases
Graph databases
Among many NoSQL products, MongoDB is popular for its powerful features and ease of use. It is an open‑source distributed database that stores data as documents, making it the most relational‑like NoSQL system with a gentle learning curve.
MongoDB’s storage hierarchy consists of databases, collections, documents, and fields:
Field : a name‑value pair, similar to a column in a relational table.
Document : the basic data unit stored in BSON (binary JSON) format.
Collection : a group of documents, analogous to a table.
Database : a container for multiple collections, similar to a relational database.
To install MongoDB 7.0 on CentOS 7, you can use the yum repository. First, create the repository file:
vi /etc/yum.repos.d/mongodb-org-7.0.repoThen add the following configuration:
[Mongodb-org-7.0]
name=MongoDB Repository
baseurl=https://repo.mongodb.org/yum/redhat/$releasever/mongodb-org/7.0/x86_64/
gpgcheck=1
enabled=1
gpgkey=https://www.mongodb.org/static/pgp/server-7.0.ascInstall the packages:
sudo yum install -y mongodb-orgAlternatively, you can download the RPM files manually and install them:
rpm -ivh mongodb-org-server-7.0.2-1.el7.x86_64.rpm
rpm -ivh mongodb-org-mongos-7.0.2-1.el7.x86_64.rpm
rpm -ivh mongodb-mongosh-2.0.2.x86_64.rpmAfter installation, run mongosh and execute show dbs to verify that MongoDB is working correctly.
Full-Stack Internet Architecture
Introducing full-stack Internet architecture technologies centered on Java
How this landed with the community
Was this worth your time?
0 Comments
Thoughtful readers leave field notes, pushback, and hard-won operational detail here.