Docs Menu

deleteShardFromZone

removeShardFromZone

The removeShardFromZone administrative command removes the association between a shard and a ゾーン.

Tip

mongoshでは、このコマンドはsh.removeShardFromZone()ヘルパー メソッドを通じて実行することもできます。

ヘルパー メソッドはmongoshユーザーには便利ですが、データベースコマンドと同じレベルの情報は返されない可能性があります。 便宜上必要ない場合、または追加の戻りフィールドが必要な場合は、 データベースコマンドを使用します。

このコマンドは、次の環境でホストされている配置で使用できます。

  • MongoDB Atlas はクラウドでの MongoDB 配置のためのフルマネージド サービスです

重要

このコマンドはサーバーレスインスタンスではサポートされていません。 詳細については、「サポートされていないコマンド 」を参照してください。

  • MongoDB Enterprise: サブスクリプションベースの自己管理型 MongoDB バージョン

  • MongoDB Community: ソースが利用可能で、無料で使用できる自己管理型の MongoDB のバージョン

You can only run removeShardFromZone on the admin database from a mongos instance.

このコマンドの構文は、次のとおりです。

db.adminCommand(
{
removeShardFromZone: <string>,
zone: <string>
}
)

このコマンドは、次のフィールドを使用します。

フィールド
タイプ
説明

string

The name of the shard from which to remove the ゾーン association.

string

The name of the zone whose association with the シャード you want to remove.

mongosh provides the helper method 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.

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.

シャーディングされたクラスター内のゾーンの詳細については、ゾーンのマニュアル ページを参照してください。

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, and

    • find on the tags collection in the config database;

    or, alternatively

  • クラスター リソースでenableSharding を含む 権限 を持つユーザー。

The clusterAdmin or clusterManager built-in roles have the appropriate permissions for issuing removeShardFromZone. See the ロールベースのアクセス制御 manual page for more information.

The following example removes the association between shard0000 and zone NYC:

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