Para agentes de IA: um índice de documentação está disponível em https://www.mongodb.com/pt-br/docs/llms.txt — as versões de markdown de todas as páginas estão disponíveis anexando .md a qualquer caminho de URL.
Menu Docs

removeShardFromZone (comando de banco de dados)

removeShardFromZone

The removeShardFromZone administrative command removes the association between a shard and a zone.

Dica

In mongosh, this command can also be run through the sh.removeShardFromZone() helper method.

Helper methods are convenient for mongosh users, 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.

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

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>
}
)

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().

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.

Para clusters fragmentados que impõem controle de acesso, você deve autenticar como:

  • um usuário cujos privilégios incluem:

    • update na collection shards no banco de dados config e

    • find na collection tags no reconhecimento de data center config ;

    ou, alternativamente

  • um usuário cujos privilégios incluem enableSharding no 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.

O exemplo a seguir remove a associação entre shard0000 e a zona NYC:

db.adminCommand( { removeShardFromZone : "shard0000" , zone : "NYC" } )