定義
getClusterParametergetClusterParameteris an administrative command for retrieving the values of cluster parameters. Cluster parameters are configurable parameters that affect all nodes in a sharded cluster.getClusterParameterを実行するには、db.adminCommand( { command } )メソッドを使用します。
互換性
このコマンドは、次の環境でホストされている配置で使用できます。
- MongoDB Atlas: The fully managed service for MongoDB deployments in the cloud
注意
This command is supported in all MongoDB Atlas clusters. For information on Atlas support for all commands, see Unsupported Commands.
MongoDB Enterprise: サブスクリプションベースの自己管理型 MongoDB バージョン
MongoDB Community: ソースが利用可能で、無料で使用できる自己管理型の MongoDB のバージョン
構文
このコマンドの構文は、次のとおりです。
db.adminCommand( { getClusterParameter: <parameter> | [<parameter>, <parameter>] | "'*'" } )
コマンドフィールド
このコマンドは、次のフィールドを使用します。
フィールド | タイプ | 説明 |
|---|---|---|
| 文字列または複数の文字列の配列 | 次のいずれかを指定できます。
|
動作
getClusterParameterはadminデータベースでのみ実行できます。 他のデータベースで コマンドを実行すると、MongoDB はエラーを返します。レプリカセットまたはシャーディングされたクラスター内の任意のノードで
getClusterParameterを実行できます。mongodでgetClusterParameterを実行すると、getClusterParameterはキャッシュされたパラメータ値を返します。で
getClusterParametermongosを実行すると、getClusterParameterは コンフィギュレーションサーバー からクラスター パラメータの 永続 値を返します。
アクセス制御
認証が有効になっている場合、 getClusterParameterはgetClusterParameterアクションへのアクセス権を持つロールを持つユーザーとして認証された場合にのみ機能します。
MongoDB Atlasユーザーには atlasAdmin ロールが必要です。
例
注意
次の例の出力は、実行中の MongoDB 配置の特定の構成によって異なる場合があります。
Retrieve Single Cluster Parameter
次の操作では、 hostNameの値を使用してadminデータベースでgetClusterParameterを実行し、 hostNameという名前の仮想クラスター パラメータの値を取得します。
use admin db.adminCommand( { getClusterParameter : "hostName" } )
Retrieve Multiple Cluster Parameters
次の操作では、 hostNameとtestParameterの値を使用してadminデータベースでgetClusterParameterを実行し、 hostNameとtestParameterという名前の仮想クラスター パラメータの値を取得します。
use admin db.adminCommand( { getClusterParameter: [ "hostName", "testParameter" ] } )
Retrieve All Cluster Parameters
次の操作では、 '*'の 値を持つgetClusterParameterを実行し、すべてのクラスター パラメータから 値を取得します。
use admin db.adminCommand( { getClusterParameter : '*' } )
Tip
setClusterParameter これらのパラメーターの詳細については、 を参照してください。