Database Reference
In-Depth Information
Learning about sharding
The good news is that MongoDB has come up with a clever solution to scale your database
system easily. Sharding is a technique used to scale a database horizontally.
Using sharding, the entire database is divided into separate single databases on different
machines. Finally, using a query router, all the separate nodes make a single logical data-
base.
Let's look at an example of sharding. Suppose we have a database sized 1 TB. Storing such
a large dataset on a single server is a big challenge, so we use sharding to divide the entire
database into smaller instances called shards .
In order to reduce the size of the entire database, we divide it into databases sized 256 GB.
During the sharding procedure, each part of the database is divided using a shard key and
other options that configure settings for shards such as the size of the dataset.
The following diagram illustrates the example of a 1 TB database being sharded across four
instances:
Search WWH ::




Custom Search