On this page本页内容
removeShardFromZone The removeShardFromZone administrative command removes the association between a shard and a zone.removeShardFromZone管理命令删除分片和区域之间的关联。
You can only run 只能从removeShardFromZone on the admin database from a mongos instance.mongos实例在admin数据库上运行removeShardFromZone。
The removeShardFromZone command has the following syntax:removeShardFromZone命令具有以下语法:
db.adminCommand(
{
removeShardFromZone: <string>,
zone: <string>
}
)
The command takes the following fields:该命令接受以下字段:
removeShardFromZone | string |
|
zone | string |
|
mongosh provides the helper method 提供了助手方法sh.removeShardFromZone().sh.removeShardFromZone()。
removeShardFromZone does not remove ranges associated with the zone.不会删除与区域关联的范围。
To completely remove a zone from the cluster, you must run 要从集群中完全删除某个区域,必须在与该区域关联的每个分片上运行removeShardFromZone on each shard associated with the zone.removeShardFromZone。
If the shard specified is the last shard associated with the zone, you must ensure there are no remaining shard key ranges associated with the zone. 如果指定的分片是与区域关联的最后一个分片,则必须确保没有剩余的分片键范围与区域关联。Use 在运行updateZoneKeyRange to remove any existing ranges associated with the zone before running removeShardFromZone.removeShardFromZone之前,请使用updateZoneKeyRange删除与区域关联的所有现有范围。
See the zone manual page for more information on zones in sharded clusters.有关分片化集群中的区域的更多信息,请参阅区域手册页面。
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 removeShardFromZone. clusterAdmin或clusterManager内置角色具有发出removeShardFromZone的相应权限。See the Role-Based Access Control manual page for more information.有关详细信息,请参阅基于角色的访问控制手册页面。
The following example removes the association between 以下示例删除了shard0000 and zone NYC:shard0000和区域NYC之间的关联:
db.adminCommand( { removeShardFromZone : "shard0000" , zone : "NYC" } )