Mongodb chunksize issue

by Rakesh Bhatt   Last Updated May 28, 2018 10:06 AM

I have a collection which have size : 60 GB

I want to shard this collection. Shard key is hash index and unique.

I followed this document https://docs.mongodb.com/manual/reference/limits/#Sharding-Existing-Collection-Data-Size

Avg byte size of shard key values 56287232

maxCollectionSize is coming 9.28 GB

As maxCollectionSize and Actual collection size different is huge i am unable to get what chunk size should i use

Thanks for help

Tags : mongodb sharding


Answers 1


As per MongoDB documentation Modify Chunk Size in a Sharded Cluster The default chunk size for a sharded cluster is 64 megabytes.

As MongoDB documentation here New in version 2.6: MongoDB provides the mergeChunks command to combine contiguous chunk ranges into a single chunk. See Merge Chunks in a Sharded Cluster for more information.

Note: Be careful when splitting data in a sharded collection to create new chunks. When you shard a collection that has existing data, MongoDB automatically creates chunks to evenly distribute the collection. To split data effectively in a sharded cluster you must consider the number of documents in a chunk and the average document size to create a uniform chunk size. When chunks have irregular sizes, shards may have an equal number of chunks but have very different data sizes. Avoid creating splits that lead to a collection with differently sized chunks.

For further your ref here

Md Haidar Ali Khan
Md Haidar Ali Khan
May 28, 2018 10:00 AM

Related Questions



How can I separate some collections to another server?

Updated October 06, 2016 09:02 AM

MongoDB sharded cluster chunks distribution

Updated February 10, 2018 15:06 PM


Could not add Replica Set to MongoDB Shard

Updated April 18, 2017 12:06 PM