sh.removeShardFromZone()
Definition
New in version 3.4.
Removes the association between a zone and a shard.
ParameterTypeDescriptionshard
stringThe name of the shard from which to remove association with the zone
.zone
stringThe name of the zone from which to remove assocation with the shard
.
Only issue sh.removeShardFromZone()
when connected to amongos
instance.
Behavior
sh.removeShardFromZone()
does not remove ranges associated with thezone.
To completely remove a zone from the cluster, you must runsh.removeShardFromZone()
on each shard associated with the zone.
If the shard specified is the last shard associated with the zone, youmust ensure there are no remaining ranges associated with the zone. UseupdateZoneKeyRange
to remove any existing ranges associated tothe zone before running sh.removeShardFromZone()
.
See the zone manual page for more information on zonesin sharded clusters.
Balancer
Removing the association between a zone and a shard removes the constraintskeeping chunks covered by the zone on the shard. During the next balancerround, the balancer may migrate chunks that previously covered by the zone.
See the sharded cluster balancer manual pagefor more information on how migrations work in a sharded cluster.
Security
For sharded clusters running with authentication, youmust authenticate as a user whose privileges include:
update
on theconfig.shards
collection or theconfig
databasefind
on theconfig.tags
collection or theconfig
database
The clusterAdmin
or clusterManager
built-in roles havethe appropriate permissions for issuing sh.removeShardFromZone()
.See the Role-Based Access Control manual page for moreinformation.
Example
The following example removes the association between shard0000
and theNYC
zone:
- sh.removeShardFromZone("shard0000", "NYC")
See also
sh.addShardToZone()
,sh.updateZoneKeyRange()
,sh.removeRangeFromZone()