Docs Menu

sh.removeShardFromZone()

sh.removeShardFromZone(shard, zone)

バージョン 3.4 で追加

Removes the association between a ゾーン and a shard.

重要

mongosh メソッド

このページでは、mongosh メソッドについて記載しています。ただし、データベースコマンドや Node.js などの言語固有のドライバーのドキュメントには該当しません

データベースコマンドについては、removeShardFromZone コマンドを参照してください。

MongoDB API ドライバーについては、各言語の MongoDB ドライバー ドキュメントを参照してください。

This method has the following parameters:

Parameter
タイプ
説明

string

ゾーン関連付けを削除するシャードの名前。

string

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

sh.removeShardFromZone()インスタンスに接続されている場合にのみmongos を発行します。

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

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

重要

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

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

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

sh.removeShardFromZone()では、ゾーンに関連付けられている範囲は削除されません。

クラスターからゾーンを完全に削除するには、ゾーンに関連付けられている各シャードで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().

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

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.

アクセス制御を強制するシャーディングされたクラスターの場合は、次のいずれかとして認証する必要があります。

  • 次の特権を持つユーザー:

    • データベース内のupdate shardsコレクションにある { }、およびconfig

    • findtagsデータベース内のconfig コレクションにある {

    または、あるいは、

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

The clusterAdmin or clusterManager built-in roles have the appropriate permissions for issuing 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:

sh.removeShardFromZone("shard0000", "NYC")