Grokking MongoDB
0% completed
Ranged Sharding
We inserted 5,000 log entries into a collection on a two-shard cluster, and all 5,000 went to one shard. The other shard received nothing, although the cluster was working correctly. The collection used ranged sharding on a timestamp, and this result follows directly from how that strategy places documents.
Ranged sharding keeps documents in shard key order. Each chunk covers one continuous range of values, so documents with nearby values are stored together. It is what you get from any shard key that is not hashed. We will build the same `logs
.....
.....
.....
Like the course? Get enrolled and start learning!
Reading Progress
0%