Definition
stopShardDrainingStops 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
startShardDrainingcommand.To check the status of a draining shard, use the
shardDrainingStatuscommand.To remove a shard after it finishes draining, use the
commitShardRemovalcommand.New in version 8.3.
Compatibility
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.
Syntax
The command has the following syntax:
db.adminCommand( { stopShardDraining: <shard> } )
Behavior
Access Requirements
If you have authorization enabled, you must
have the clusterManager role or any role that
includes the removeShard action.
Examples
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" } )