On this page本页内容
sh.removeShardFromZone(shard, zone)
Removes the association between a zone and a shard.删除分区和分片之间的关联。
shard | string |
|
zone | string |
|
Only issue 仅在连接到sh.removeShardFromZone()
when connected to a mongos
instance.mongos
实例时发出sh.removeShardFromZone()
。
sh.removeShardFromZone()
does not remove ranges associated with the zone.不会删除与区域关联的范围。
To completely remove a zone from the cluster, you must run 要从集群中完全删除某个区域,必须对与该区域关联的每个分片运行sh.removeShardFromZone()
on each shard associated with the zone.sh.removeShardFromZone()
。
If the shard specified is the last shard associated with the zone, you must ensure there are no remaining ranges associated with the zone. 如果指定的分片是与区域关联的最后一个分片,则必须确保没有与该区域关联的剩余范围。Use 在运行updateZoneKeyRange
to remove any existing ranges associated to the zone before running sh.removeShardFromZone()
.sh.removeShardFromZone()
之前,请使用updateZoneKeyRange
删除与该区域关联的任何现有范围。
See the zone manual page for more information on zones in sharded clusters.有关分片集群中分区的详细信息,请参阅分区手册页面。
Removing the association between a zone and a shard removes the constraints keeping chunks covered by the zone on the shard. During the next balancer round, the balancer may migrate chunks that previously covered by the zone.删除分区和分片之间的关联将删除限制,使分区覆盖分片上的块。在下一轮平衡器中,平衡器可能会迁移以前由区域覆盖的块。
See the sharded cluster balancer manual page for more information on how migrations work in a sharded cluster.有关迁移如何在分片集群中工作的更多信息,请参阅分片集群平衡器手册页。
For sharded clusters that enforce access control, you must authenticate either as:对于强制访问控制的分片群集,必须使用以下身份验证:
a user whose privileges include:其权限包括:
update
on the shards
collection in the config
database, andconfig
数据库中的shards
集合,以及find
on the tags
collection in the config
database;config
数据库中的tags
集合中查找;or, alternatively,或者,作为替代,
enableSharding
on the cluster resource (available starting in version 4.2.2, 4.0.14, 3.6.16).enableSharding
用户(从版本4.2.2、4.0.14、3.6.16开始可用)。The clusterAdmin
or clusterManager
built-in roles have the appropriate permissions for issuing sh.removeShardFromZone()
. clusterAdmin
或clusterManager
内置角色具有发出sh.removeShardFromZone()
的适当权限。See the Role-Based Access Control manual page for more information.有关详细信息,请参阅基于角色的访问控制手册页。
The following example removes the association between 以下示例删除shard0000
and the NYC
zone:shard0000
和NYC
区域之间的关联:
sh.removeShardFromZone("shard0000", "NYC")