Docs Menu
Docs Home
/ /

stopShardDraining (database command)

stopShardDraining

Stops the balancer from draining chunks off the given shard.

When the command runs, it tells the balancer that you want the shard to remain in the cluster. The balancer then stops draining the shard and again includes the shard in rebalance operations, shifting chunks back onto the shard.

The command returns an error if the shard doesn't exist, otherwise it returns ok.

To start draining a shard, use the startShardDraining command.

To check the status of a draining shard, use the shardDrainingStatus command.

To remove a shard after it finishes draining, use the commitShardRemoval command.

New in version 8.3.

This command is available in deployments hosted in the following environments:

  • MongoDB Enterprise: The subscription-based, self-managed version of MongoDB

  • MongoDB Community: The source-available, free-to-use, and self-managed version of MongoDB

Note

This command is not supported in MongoDB Atlas. See Modify your Atlas Sharded Cluster to add or remove shards from your Atlas cluster.

The command has the following syntax:

db.adminCommand( {
stopShardDraining: <shard>
} )

If you have authorization enabled, you must have the clusterManager role or any role that includes the removeShard action.

To start draining a shard, use the db.adminCommand() method to run the startShardDraining command:

db.adminCommand( { startShardDraining: "shard04" } )

To stop draining the shard, use the db.adminCommand() method to run the stopShardDraining command:

db.adminCommand( { stopShardDraining: "shard04" } )

Back

startShardDraining

On this page