Understanding sharding

For the sake of illustration, we have a collection, X. Originally residing on a single server, we can create three shards and spread the collection across three servers. Each shard can be a replica set (which we discussed previously):

You would normally configure a mongos (MongoDB shard routing service) (https://docs.mongodb.com/manual/core/sharded-cluster-query-router/#mongos) instance to route reads and writes to specific shards in the cluster. The mongos instances are lightweight and can greatly enhance performance and scalability, especially when dealing with massive amounts of data. Config servers (https://docs.mongodb.com/manual/core/sharded-cluster-config-servers/#config-servers ...

Get MongoDB 4 Quick Start Guide now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.