Shard in MongoDB
What is sharding?
Sharding is a process of storing data records across multiple devices and it is a method of MongoDB to meet the requirement for increasing data. When the size of the data increases, a single device cannot be enough to store data. Sharding solved this problem with expanding horizontal scaling. With Sharding, you add more devices to support the increase in data and the requirements of read and write operations.
Why use Sharding?
In Replication, all write operations are performed at the primary node.
Potential queries still go to the primary node.
A single Replica Set has a limit of 12 nodes.
Memory cannot be large enough when the data set is large.
Local Disk is not big enough.
Vertical scaling is too costly.
Sharding in MongoDB
Below is a Sharding diagram in MongoDB using Sharded Cluster.
In the diagram above, there are three main components:
Shards : used to store data. They provide high availability and uniform data. In the creation environment, each Shard is a separate Replica Set.
Config Servers : save Cluster metadata. This data contains a mapping of Cluster to Shards data set. Query Router uses this metadata to direct specific Shards operations. In the creation environment, sharded clusters have exactly 3 Config Servers.
Query Routers : it is basically an instance, interfaces with the Client Application and directs operations to the appropriate Shard. Query Router processes and directs operations to the Shard and then returns the results to the client. A Sharded Cluster can contain more than one Query Router to divide the request load from the Client. A Client sends requests to a Query Router. In general, a Sharded Cluster has many Query Routers.
According to Tutorialspoint
Previous article: Replica Set in MongoDB
Next article: Create Backup in MongoDB
You should read it
- MongoDB queries and tasks you should know
- Instructions on 2 ways to install MongoDB on Raspberry Pi
- Index (Mong) in MongoDB
- Advantages of MongoDB
- Data type in MongoDB
- MongoDB malicious code attacks more than 26,000 victims in a week
- Query Document in MongoDB
- Learn about security features and authentication in MongoDB
- ObjectId in MongoDB
- Text Search in MongoDB
- Learn about Java Driver in MongoDB
- Install MongoDB
Maybe you are interested
IBM Unveils Breakthrough Optical Data Transmission Technology That Enables 'Light-Speed' AI Training
How to use the Round function in Excel to round numbers and process data
How to Overwrite Deleted Data on a Drive in Windows 11/10
How to sort data in Excel using Sort is extremely simple
How to stay safe from 'SpyLoan' Android apps that use your data to blackmail you
6 Excel functions to find data quickly