Mongodb – Adding more space + bandwidth to a MongoDB cluster

clusteringmongodbmongodb-3.0sharding

I've read a lot about sharding and have gone through cluster setup process as well. What I can't get my head around is the actual database capacity after its sharded.

So say for instance I have one master server + 3 config servers + 5 shards.

If master has 30 GB available, each shard has 40 GB and each of the config servers have available space of 20 GB, what is my total capacity for a sharded collection in the cluster?

Is it 230 GB? How do I find this out? Is there a command that I can run?

Also, as I scale out, wouldn't that put more and more stress on the master node in terms of resources/bandwidth? Can I have multiple masters? Or replication across two sets of clusters?

Thanks in advance 😀

Best Answer

The config servers only hold metadata about which chunk is stored on which cluster, no actual data.

There is no such thing called a "master server" in mongoDB, but I think what you are talking about is the shard router (mongos). When that is the case, then that server doesn't store any data at all.

So the total capacity of the cluster is the sum of the capacity of your shards, which is 40GB * 5 = 200GB.

Should the mongo router become a bottleneck, you can add more of them. A cluster can be accessed by any number of routers. By the way: it's not uncommon to put the mongos process(es) on the same machines where the application(s) are running.

"Or replication across two sets of clusters?"

Replication in MongoDB is on shard-level. Each shard can (and in a production setup should) be a replica-set of two or more nodes.