Definição
removeShardFromZoneThe
removeShardFromZoneadministrative command removes the association between a shard and a zone.Dica
In
mongosh, this command can also be run through thesh.removeShardFromZone()helper method.Helper methods are convenient for
mongoshusers, but they may not return the same level of information as database commands. In cases where the convenience is not needed or the additional return fields are required, use the database command.
Compatibilidade
Esse comando está disponível em implantações hospedadas nos seguintes ambientes:
- MongoDB Atlas: o serviço totalmente gerenciado para implantações do MongoDB na nuvem
MongoDB Enterprise: a versão autogerenciada e baseada em assinatura do MongoDB
MongoDB Community: uma versão com código disponível, de uso gratuito e autogerenciada do MongoDB
Sintaxe
You can only run removeShardFromZone on the admin database from a mongos instance.
O comando tem a seguinte sintaxe:
db.adminCommand( { removeShardFromZone: <string>, zone: <string> } )
Campos de comando
O comando utiliza os seguintes campos:
Campo | Tipo | Descrição |
|---|---|---|
string | The name of the shard from which to remove the zone association. | |
string | The name of the zone whose association with the shard you want to remove. |
mongosh provides the helper method sh.removeShardFromZone().
Comportamento
removeShardFromZone não remove as faixas associadas à zona.
To completely remove a zone from the cluster, you must run removeShardFromZone on each shard associated with the zone.
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.
Consulte a página do manual de zonas para obter mais informações sobre zonas em clusters fragmentados.
Segurança
Para clusters fragmentados que impõem controle de acesso, você deve autenticar como:
um usuário cujos privilégios incluem
enableShardingno recurso do cluster .
The clusterAdmin or clusterManager built-in roles have the appropriate permissions for issuing removeShardFromZone. See the Role-Based Access Control manual page for more information.
Exemplo
O exemplo a seguir remove a associação entre shard0000 e a zona NYC:
db.adminCommand( { removeShardFromZone : "shard0000" , zone : "NYC" } )