Docs Menu

Docs HomeDevelop ApplicationsMongoDB Manual

Sharding Reference

On this page

  • Sharding Methods in the mongo Shell
  • Sharding Database Commands
  • Reference Documentation
Name
Description
sh.addShard()
Adds a shard to a sharded cluster.
In MongoDB 3.4, this method aliases to sh.addShardToZone().
Associates a shard to a zone. Supports configuring zones in sharded clusters.
In MongoDB 3.4, this method aliases to sh.updateZoneKeyRange().

Returns information on whether the chunks of a sharded collection are balanced.

New in version 4.4.

Disable balancing on a single collection in a sharded database. Does not affect balancing of other collections in a sharded cluster.
Activates the sharded collection balancer process if previously disabled using sh.disableBalancing().
Disables auto-splitting for the sharded cluster.
Enables auto-splitting for the sharded cluster.
Enables sharding on a specific database.
Returns a boolean to report if the balancer is currently enabled.
In MongoDB 3.4, this method aliases to sh.removeRangeFromZone().
Removes an association between a range of shard keys and a zone. Supports configuring zones in sharded clusters.
Returns help text for the sh methods.
Returns a boolean to report if the balancer process is currently migrating chunks.
Migrates a chunk in a sharded cluster.
In MongoDB 3.4, this method aliases to sh.removeShardFromZone().
Removes the association between a shard and a zone. Use to manage zone sharding.
Enables or disables the balancer which migrates chunks between shards.
Enables sharding for a collection.
Divides an existing chunk into two chunks using a specific value of the shard key as the dividing point.
Divides an existing chunk that contains a document matching a query into two approximately equal chunks.
Enables the balancer and waits for balancing to start.
Reports on the status of a sharded cluster, as db.printShardingStatus().
Disables the balancer and waits for any in progress balancing rounds to complete.
Internal. Waits for the balancer state to change.
Internal. Waits until the balancer stops running.
Internal. Waits for a change in ping state from one of the mongos in the sharded cluster.
Associates a range of shard keys to a zone. Supports configuring zones in sharded clusters.
Returns the hashed value for the input.

The following database commands support sharded clusters.

Name
Description
Associates a shard with a zone. Supports configuring zones in sharded clusters.

Returns information on whether the chunks of a sharded collection are balanced.

New in version 4.4.

Starts a balancer thread.
Returns information on the balancer status.
Stops the balancer thread.
Internal command that validates index on shard key.
Clears the jumbo flag for a chunk.
Removes orphaned data with shard key values outside of the ranges of the chunks owned by a shard.
Enables sharding on a specific database.
Forces a mongod / mongos instance to update its cached routing metadata.
Internal command that reports on the state of a sharded cluster.
Internal command that returns the config server version.
Verifies that a process is a mongos.
Returns a list of configured shards.
Internal command that migrates chunks between shards.
Reassigns the primary shard when removing a shard from a sharded cluster.
Provides the ability to combine chunks on a single shard.
Starts the process of removing a shard from a sharded cluster.
Removes the association between a shard and a zone. Supports configuring zones in sharded clusters.
Internal command to sets the config server version.
Enables the sharding functionality for a collection, allowing the collection to be sharded.
Reports whether the mongod is a member of a sharded cluster.
Creates a new chunk.
Internal command that determines split points.
Deprecated. Internal command that affects connections between instances in a MongoDB deployment.
Adds or removes the association between a range of sharded data and a zone. Supports configuring zones in sharded clusters.
Operational Restrictions
Requirement for deploying a sharded cluster
Troubleshoot Sharded Clusters
Common strategies for troubleshooting sharded cluster deployments.
Config Database
Complete documentation of the content of the local database that MongoDB uses to store sharded cluster metadata.
← Convert a Replica Set to a Sharded Cluster