定義
connPoolStatsコマンド は、現在のデータベースインスタンスから
connPoolStatsの シャーディングされたクラスターまたはレプリカセットの他のノードへの開いている送信接続に関する情報を返します。connPoolStatsを実行するには、db.runCommand( { <command> } )メソッドを使用します。注意
connPoolStatsは、シャーディングされたクラスター内のmongosインスタンスとmongodインスタンスに対してのみ意味のある結果を返します。
互換性
このコマンドは、次の環境でホストされている配置で使用できます。
MongoDB Atlas はクラウドでの MongoDB 配置のためのフルマネージド サービスです
注意
このコマンドは、すべての MongoDB Atlas クラスターでサポートされています。すべてのコマンドに対する Atlas のサポートについては、「サポートされていないコマンド」を参照してください。
MongoDB Enterprise: サブスクリプションベースの自己管理型 MongoDB バージョン
MongoDB Community: ソースが利用可能で、無料で使用できる自己管理型の MongoDB のバージョン
構文
このコマンドの構文は、次のとおりです。
db.runCommand( { connPoolStats: 1 } )
引数の値( 1 )は、コマンドの出力には影響しません。
動作
connPoolStats には、出力に集計統計が含まれます。
注意
実行中の操作の中断を避けるため、 connPoolStatsはロックを取得しません。 そのため、 connPoolStatsが情報を収集するにつれてカウントが若干変化する可能性があり、 hostsとpoolsの接続数に若干違いが生じます。
例
次の操作では、 メソッドを使用して、シャーディングされたクラスターの でdb.runCommand() connPoolStatsmongosコマンドを実行します。シャーディングされたクラスターには、 2のシャード、それぞれの単一ノードのレプリカセット、コンフィギュレーションサーバーのレプリカセットがあります。 mongosは4コアマシンで動作します。
db.runCommand( { "connPoolStats" : 1 } )
このコマンドは、次の形式の出力を返します。
注意
connPoolStatsの出力は、 connPoolStatsを実行する配置やノードなどの要因によって異なります。
{ "numClientConnections" : <num>, "numAScopedConnections" : <num>, "totalInUse" : <num>, "totalAvailable" : <num>, "totalLeased" : <num>, "totalCreated" : <num>, "totalRefreshing" : <num>, "replicaSetMatchingStrategy" : <string>, "pools" : { "NetworkInterfaceTL-TaskExecutorPool-0" : { "poolInUse" : <num>, "poolAvailable" : <num>, "poolLeased" : <num>, "poolCreated" : <num>, "poolRefreshing" : <num>, "cfg1.example.net:27019" : { "inUse" : <num>, "available" : <num>, "leased" : <num>, "created" : <num>, "refreshing" :<num> } }, "NetworkInterfaceTL-TaskExecutorPool-1" : { "poolInUse" : <num>, "poolAvailable" : <num>, "poolLeased" : <num>, "poolCreated" : <num>, "poolRefreshing" : <num>, "cfg1.example.net:27019" : { "inUse" : <num>, "available" : <num>, "leased" : <num>, "created" : <num>, "refreshing" :<num> } }, "NetworkInterfaceTL-TaskExecutorPool-2" : { "poolInUse" : <num>, "poolAvailable" : <num>, "poolLeased" : <num>, "poolCreated" : <num>, "poolRefreshing" : <num>, "cfg1.example.net:27019" : { "inUse" : <num>, "available" : <num>, "leased" : <num>, "created" : <num>, "refreshing" :<num> } }, "NetworkInterfaceTL-TaskExecutorPool-3" : { "poolInUse" : <num>, "poolAvailable" : <num>, "poolLeased" : <num>, "poolCreated" : <num>, "poolRefreshing" : <num>, "cfg1.example.net:27019" : { "inUse" : <num>, "available" : <num>, "leased" : <num>, "created" : <num>, "refreshing" :<num> } }, "NetworkInterfaceTL-ShardRegistry" : { "poolInUse" : <num>, "poolAvailable" : <num>, "poolLeased" : <num>, "poolCreated" : <num>, "poolRefreshing" : <num>, "cfg1.example.net:27019" : { "inUse" : <num>, "available" : <num>, "leased" : <num>, "created" : <num>, "refreshing" :<num> }, "cfg2.example.net:27019" : { "inUse" : <num>, "available" : <num>, "leased" : <num>, "created" : <num>, "refreshing" :<num> }, "cfg3.example.net:27019" : { "inUse" : <num>, "available" : <num>, "leased" : <num>, "created" : <num>, "refreshing" :<num> }, "shard1.example.net:27018" : { "inUse" : <num>, "available" : <num>, "leased" : <num>, "created" : <num>, "refreshing" :<num> }, "shard2.example.net:27018" : { "inUse" : <num>, "available" : <num>, "leased" : <num>, "created" : <num>, "refreshing" :<num> } }, "global" : { "poolInUse" : <num>, "poolAvailable" : <num>, "poolLeased" : <num>, "poolCreated" : <num>, "poolRefreshing" : <num>, "cfg3.example.net:27019" : { "inUse" : <num>, "available" : <num>, "leased" : <num>, "created" : <num>, "refreshing" :<num> }, "cfg1.example.net:27019" : { "inUse" : <num>, "available" : <num>, "leased" : <num>, "created" : <num>, "refreshing" :<num> }, "cfg2.example.net:27019" : { "inUse" : <num>, "available" : <num>, "leased" : <num>, "created" : <num>, "refreshing" :<num> }, "shard2.example.net:27018" : { "inUse" : <num>, "available" : <num>, "leased" : <num>, "created" : <num>, "refreshing" :<num> }, "shard1.example.net:27018" : { "inUse" : <num>, "available" : <num>, "leased" : <num>, "created" : <num>, "refreshing" :<num> } } }, "hosts" : { "cfg3.example.net:27019" : { "inUse" : <num>, "available" : <num>, "leased" : <num>, "created" : <num>, "refreshing" :<num> }, "cfg1.example.net:27019" : { "inUse" : <num>, "available" : <num>, "leased" : <num>, "created" : <num>, "refreshing" :<num> }, "cfg2.example.net:27019" : { "inUse" : <num>, "available" : <num>, "leased" : <num>, "created" : <num>, "refreshing" :<num> }, "shard2.example.net:27018" : { "inUse" : <num>, "available" : <num>, "leased" : <num>, "created" : <num>, "refreshing" :<num> }, "shard1.example.net:27018" : { "inUse" : <num>, "available" : <num>, "leased" : <num>, "created" : <num>, "refreshing" :<num> } }, "replicaSets" : { "csRS" : { "hosts" : [ { "addr" : "cfg1.example.net:27019", "ok" : <bool>, "ismaster" : <bool>, "hidden" : <bool>, "secondary" : <bool>, "pingTimeMillis" : <num> }, { "addr" : "cfg2.example.net:27019", "ok" : <bool>, "ismaster" : <bool>, "hidden" : <bool>, "secondary" : <bool>, "pingTimeMillis" : <num> }, { "addr" : "cfg3.example.net:27019", "ok" : <bool>, "ismaster" : <bool>, "hidden" : <bool>, "secondary" : <bool>, "pingTimeMillis" : <num> } ] }, "shardB" : { "hosts" : [ { "addr" : "shard2.example.net:27018", "ok" : <bool>, "ismaster" : <bool>, "hidden" : <bool>, "secondary" : <bool>, "pingTimeMillis" : <num> } ] }, "shardA" : { "hosts" : [ { "addr" : "shard1.example.net:27018", "ok" : <bool>, "ismaster" : <bool>, "hidden" : <bool>, "secondary" : <bool>, "pingTimeMillis" : <num> } ] } }, "ok" : 1, "$clusterTime" : { "clusterTime" : <timestamp>, "signature" : <document> }, "operationTime" : <timestamp> }
出力
connPoolStats.totalAvailable現在の
mongod/mongosインスタンスからシャーディングされたクラスターまたはレプリカセットの他のノードへの利用可能な送信接続の合計数を報告します。
connPoolStats.totalLeasedプールから追加され、返されることが予想される接続の合計数を報告します。 これらの接続はリージョン中はアクティブではない可能性があり、関連メトリクスから除外されます。 これらの接続は、リージョン中は使用できなくなります。
connPoolStats.totalCreated現在の
mongod/mongosインスタンスによって作成された送信接続の合計数を、シャーディングされたクラスターまたはレプリカセットの他のノードに対して報告します。
connPoolStats.totalInUse現在の
mongod/mongosインスタンスから、現在使用されているシャーディングされたクラスターまたはレプリカセットの他のノードへの送信接続の合計数を報告します。
connPoolStats.totalRefreshing現在の
mongod/mongosインスタンスから、現在更新されているシャーディングされたクラスターまたはレプリカセットの他のノードへの送信接続の合計数を報告します。
connPoolStats.totalWasNeverUsed現在の
mongod/mongosインスタンスから、使用されていないシャーディングされたクラスターまたはレプリカセットの他のノードへの送信接続の合計数を報告します。
connPoolStats.replicaSetMatchingStrategyバージョン 5.0 で追加
mongosインスタンスでは、この値はインスタンスがレプリカセット内のノードへの接続プールの最小サイズ制限を決定するために使用するポリシーを報告します。mongodインスタンスでは、この値はインスタンスが他のレプリカセット内のノードへの接続プールの最小サイズ制限を決定するために使用するポリシーを報告します。mongosとmongodのポリシーは、ShardingTaskExecutorPoolReplicaSetMatchingパラメータを使用して設定できます。注意
ShardingTaskExecutorPoolReplicaSetMatchingが"automatic"に設定されている場合、"automatic"replicaSetMatchingStrategyが実際に使用されているポリシーを記述します。ShardingTaskExecutorPoolReplicaSetMatchingの値を見つけるには、サーバー パラメータの値を返すgetParameterを使用します。db.adminCommand( { getParameter : 1, "ShardingTaskExecutorPoolReplicaSetMatching" : 1 } )
connPoolStats.numClientConnection現在の
mongod/ インスタンスからシャーディングされた クラスターmongosまたは レプリカセット の他のノードに対するアクティブで保存されている送信 同期 接続の数を報告します。これらの接続は、
totalAvailable、totalCreated、totalInUseによって報告されたデータのサブセットであるプールの一部です。
connPoolStats.numAScopedConnection現在の
mongod/ インスタンスからシャーディングされた クラスターmongosまたは レプリカセット の他のノードに対するアクティブで保存されている スコープ指定同期 接続の数を報告します。これらの接続は、
totalAvailable、totalCreated、totalInUseによって報告されたデータのサブセットであるプールの一部です。
connPoolStats.pools接続プール別にグループ化された接続統計(使用中、利用可能/作成、またはリフレッシュ中)を報告します。
mongodまたはmongosには、送信接続プールの 2 つの異なるファミリーがあります。DBClient ベースのプール(「書込みパス」)と
networkInterfaceTL ベースのプール(「読み取りパス」)。
プールごとに、 コマンドは次のようなドキュメントを返します。
{ "poolInUse" : <num>, "poolAvailable" : <num>, "poolLeased" : <num>, "poolCreated" : <num>, "poolRefreshing" : <num>, "[host1]" : { "inUse" : <num>, "available" : <num>, "leased" : <num>, "created" : <num>, "refreshing" : <num> }, "[host2]" : { "inUse" : <num>, "available" : <num>, "leased" : <num>, "created" : <num>, "refreshing" : <num> }, ... } 注意
特定のプールに接続(使用中、利用可能、作成済み、更新中)がない場合、
connPoolStatsはそのプールの統計情報を返しません。connPoolStats.pools.NetworkInterfaceTL-TaskExecutorPool-[n]TaskExecutor プールに関連する接続統計情報を表示します。 通常、コアごとに 1 つの TaskExecutorPool があり、例を以下に示します。 8 コア プロセッサの場合、
pools.NetworkInterfaceTL-TaskExecutorPool-0...pools.NetworkInterfaceTL-TaskExecutorPool-7。
connPoolStats.pools.NetworkInterfaceTL-ShardRegistryコマンドがシャーディングされたクラスターのノードで実行された場合に使用できます。
現在の
mongod/mongosインスタンスとシャーディングされたクラスターの他のノードとの間の接続のプール統計を表示します。
connPoolStats.pools.NetworkInterfaceTL-Replicationコマンドがレプリカセットのノードで実行された場合に使用できます。
現在の
mongodインスタンスとレプリカセットの他のノードとの間の接続のプール統計を表示します。
connPoolStats.hosts接続統計(使用中、利用可能/作成、またはリフレッシュ中)をホスト別にグループ化して報告します。
現在の
mongod/ インスタンスとシャーディングされた クラスターmongosまたは レプリカセット の各ノードとの間の接続のレポートを表す ドキュメント が含まれます。
connPoolStats.replicaSets現在の
mongod/ に接続されている各レプリカセットに関連する情報のレポートを表す ドキュメントmongosが含まれます。connPoolStats.replicaSets.replicaSet現在の
mongod/ に接続されている各 レプリカセットmongosについて報告します。
connPoolStats.replicaSets.[replicaSets].hostsレプリカセット 内の各ノードについて報告する ドキュメント の配列を保持します。
これらの値は、レプリカセットのステータス値から派生します。
connPoolStats.replicaSets.[replicaSet].hosts[n].addrレプリカセット内のノードのアドレスを
[hostname]:[port]形式で報告します。
connPoolStats.replicaSets.[replicaSet].hosts[n].ismastertrueこのhostが レプリカセット の プライマリ メンバーである場合、 を報告します。
connPoolStats.replicaSets.[replicaSet].hosts[n].hiddentrueこのhostが レプリカセット の 非表示ノード である場合、 を報告します。
connPoolStats.replicaSets.[replicaSet].hosts[n].secondarytrueこのhostが レプリカセット の セカンダリ メンバーである場合、 を報告します。
connPoolStats.replicaSets.[replicaSet].hosts[n].tagsセットのこのメンバーにはタグが設定されている場合、
members[n].tagsを報告します。
ok ステータス フィールド、operationTime フィールド、および $clusterTime フィールドの詳細については、「応答」も参照してください。