4. MongoDB Architecture

Página 4

The architecture of MongoDB is a fundamental aspect of understanding how this powerful NoSQL database tool works. MongoDB is a document-oriented database, which means it stores data in BSON (Binary JSON) documents, which is a binary representation of the JSON format. This architecture offers a lot of flexibility and scalability, making MongoDB a popular choice for many modern applications.

MongoDB Architecture Components

The MongoDB architecture consists of several core components, including:

  • MongoD: This is the main database process that handles all requests, manages data access, performs background operations, and interacts with clients.
  • MongoS: This is the query router for MongoDB sharded clusters. It directs client queries to the correct shard.
  • Mongo Shell: It is an interactive JavaScript interface for MongoDB. It is used for database administration, data operations, and debugging.
  • Config Servers: They store the cluster metadata that MongoS uses to route queries.

Storage Architecture

MongoDB uses a file-based storage architecture. Each database is stored in separate files on the file system, and each collection is stored as a BSON file, which is a binary representation of JSON. Additionally, each document in a collection is stored as a BSON document.

MongoDB also supports multiple storage engines, including WiredTiger and MMAPv1. WiredTiger is the default storage engine for MongoDB and supports data compression, multi-document transactions, and is optimized for high-performance workloads.

Network Architecture

MongoDB uses a client-server based network architecture. The server (MongoD) listens to client requests, performs the requested operations and returns the results. The client can be an application, the Mongo Shell, or another MongoD process.

For communication, MongoDB uses the BSON network protocol, which is a binary version of JSON. This allows MongoDB to efficiently transmit data between the client and server.

Cluster Architecture

MongoDB supports two types of clusters: Replica Sets and Sharded Clusters.

  • Replica Sets: A Replica Set is a group of MongoD servers that maintain the same set of data. A Replica Set provides redundancy and high availability and is the foundation for all MongoDB production deployments.
  • Sharded Clusters: A Shared Cluster is a group of Replica Sets that partition data between them. Sharding is a strategy for distributing data across multiple servers to support very large database workloads.

In summary, MongoDB's architecture is designed to be flexible, scalable, and capable of handling large volumes of data. The ability to choose between different storage engines, use an efficient network architecture, and scale horizontally across clusters makes MongoDB a powerful choice for many modern database applications.

Now answer the exercise about the content:

Which of the following components of the MongoDB architecture is the query router for MongoDB sharded clusters?

You are right! Congratulations, now go to the next page

You missed! Try again.

Next page of the Free Ebook:

55. Understanding BSON in MongoDB

Earn your Certificate for this Course for Free! by downloading the Cursa app and reading the ebook there. Available on Google Play or App Store!

Get it on Google Play Get it on App Store

+ 6.5 million
students

Free and Valid
Certificate with QR Code

48 thousand free
exercises

4.8/5 rating in
app stores

Free courses in
video, audio and text