定義
removeShardFromZoneThe
removeShardFromZoneadministrative command removes the association between a shard and a zone.Tip
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.
互換性
このコマンドは、次の環境でホストされている配置で使用できます。
- MongoDB Atlas: The fully managed service for MongoDB deployments in the cloud
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 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 は、ゾーンに関連付けられた範囲を削除しません。
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.
シャーディングされたクラスター内のゾーンの詳細については、ゾーンのマニュアル ページを参照してください。
セキュリティ
アクセス制御を強制するシャーディングされたクラスターの場合は、次のいずれかとして認証する必要があります。
クラスター リソースで
enableShardingを含む 権限 を持つユーザー。
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.
例
次の例では、 shard0000とゾーンNYCの間の関連付けを削除します。
db.adminCommand( { removeShardFromZone : "shard0000" , zone : "NYC" } )