Adds a shard replica set to a sharded cluster.
The command contains the following fields:
Field Type Description
The replica set name, hostname, and port of at least one member of the shard’s replica set. Any additional replica set member hostnames must be comma separated. For example:
integer Optional. The maximum size in megabytes of the shard. If you set
0, MongoDB does not limit the size of the shard.
string Optional. A name for the shard. If this is not specified, MongoDB automatically provides a unique name.
maxSizewhen you have machines with different disk capacities, or if you want to limit the amount of data on some shards. The
maxSizeconstraint prevents the balancer from migrating chunks to the shard when the
totalSizereturned from running
listDatabaseson the shard exceeds the value of
When you add a shard to a sharded cluster, you affect the balance of chunks among the shards of a cluster for all existing sharded collections. The balancer will begin migrating chunks so that the cluster will achieve balance. See Cluster Balancer for more information.
Changed in version 2.6: Chunk migrations can have an impact on disk space. Starting in MongoDB 2.6, the source shard automatically archives the migrated documents by default. For details, see moveChunk directory.