user623252
user623252

Reputation:

Query to check the MongoDB chunk size?

Is there any query to check the MongoDB chunk size?.I came to know that the default chunk size is 200MB.In the event of exceeding the chunk-size the shards gets splitted to next chunk correct?Can you guys help me....

Upvotes: 2

Views: 12071

Answers (4)

Mahesh Malpani
Mahesh Malpani

Reputation: 1999

Sorry but I tried. If setting is override then only it will be present in config setting collection.

db.collection.getShardDistribution() will give current collection chunk size and documents per chunks based on data stored in that collection. Mongo db default setting is 64MB is not set.

Upvotes: 0

Seymi
Seymi

Reputation: 21

In Mongo 3.6 you can find the chunk size in mongos with

use Name_of_db;
db.collection.getShardDistribution();

The default chunk size in 3.6 is 64 MB

The chunk will be splitted, when this size exceeds (except in case of a Jumbo chunk, which means the chunk can not be splitted because one shard key value occurs with high frequency).

Other answers refered to config.settings, but here you can find only settings, when the chunk size was changed.

Upvotes: 1

Travis Reeder
Travis Reeder

Reputation: 41123

You can check it in the "config" database:

use config
db.settings.find()

And default is 64MB, not 200.

Upvotes: 2

Gates VP
Gates VP

Reputation: 45297

Is there any query to check the MongoDB chunk size

According to the docs, there should be an option to find the config size.

Run the following while connected to a config servers (mongo configdb:port/config)

db.settings.find()

I came to know that the default chunk size is 200MB.

The 200MB number will depend on your version. Older versions default to 200MB. The newest versions will actually scale between 64MB and 200MB before issuing a split.

In the event of exceeding the chunk-size the shards gets splitted to next chunk correct?

The default behavior here is to begin the split process when a chunk hits that threshold. The move is not instant, there's a whole process of moving the data, checking that it's in sync and then "cutting over".

This should all be handled automatically as long as you have enough data to for a split. (and you've selected a shard key)

Upvotes: 1

Related Questions