Mongodb sharding best practices
- sharding in mongodb example
- what is sharding in mongodb
- types of sharding in mongodb
- how to do sharding in mongodb
Mongodb sharded cluster setup...
Sharding vs partitioning
What is Sharding in MongoDB?
Sharding is a concept in MongoDB, which splits large data sets into small data sets across multiple MongoDB instances.
Sometimes the data within MongoDB will be so huge, that queries against such big data sets can cause a lot of CPU utilization on the server.
To tackle this situation, MongoDB has a concept of Sharding, which is basically the splitting of data sets across multiple MongoDB instances.
The collection which could be large in size is actually split across multiple collections or Shards as they are called.
Logically all the shards work as one collection.
How to Implement Sharding
Shards are implemented by using clusters which are nothing but a group of MongoDB instances.
The components of a Shard include
- A Shard – This is the basic thing, and this is nothing but a MongoDB instance which holds the subset of the data.
In production environments, all shards need to be part of replica sets.
- Config server – This is a mongodb instance which holds metadata about the cluster, basically information about the various mongodb instances whic
- shard mongo