定義
connPoolStatsThe command
connPoolStatsreturns information regarding the open outgoing connections from the current database instance to other members of the sharded cluster or replica set.connPoolStatsを実行するには、db.runCommand( { <command> } )メソッドを使用します。注意
connPoolStatsonly returns meaningful results formongosinstances and formongodinstances in sharded clusters.
互換性
このコマンドは、次の環境でホストされている配置で使用できます。
- 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.runCommand( { connPoolStats: 1 } )
引数の値( 1 )は、コマンドの出力には影響しません。
動作
connPoolStats には、出力に集計統計が含まれます。
The
hostsfield displays the information aggregated by host.The
poolsfield displays the information aggregated by pool.
注意
To avoid interference with any running operations, connPoolStats does not take any locks. As such, the counts may change slightly as connPoolStats gathers information, resulting in slight differences between the hosts and pools connection counts.
例
The following operation uses the db.runCommand() method to run the connPoolStats command on a mongos of a sharded cluster. The sharded cluster has 2 shards, each a single-member replica set, and a config server replica set. The mongos runs on a 4-core machine.
db.runCommand( { "connPoolStats" : 1 } )
このコマンドは、次の形式の出力を返します。
注意
The connPoolStats output varies depending on the deployment and the member against which you run connPoolStats among other factors.
{ "numClientConnections" : <num>, "numAScopedConnections" : <num>, "totalInUse" : <num>, "totalAvailable" : <num>, "totalLeased" : <num>, "totalCreated" : <num>, "totalRefreshing" : <num>, "replicaSetMatchingStrategy" : <string>, "acquisitionWaitTimes" : { // Added in MongoDB 6.3 "(-inf, 0ms)" : { "count" : <num> }, "[0ms, 50ms)" : { "count" : <num> }, "[50ms, 100ms)" : { "count" : <num> }, "[100ms, 150ms)" : { "count" : <num> }, "[150ms, 200ms)" : { "count" : <num> }, "[200ms, 250ms)" : { "count" : <num> }, "[250ms, 300ms)" : { "count" : <num> }, "[300ms, 350ms)" : { "count" : <num> }, "[350ms, 400ms)" : { "count" : <num> }, "[400ms, 450ms)" : { "count" : <num> }, "[450ms, 500ms)" : { "count" : <num> }, "[500ms, 550ms)" : { "count" : <num> }, "[550ms, 600ms)" : { "count" : <num> }, "[600ms, 650ms)" : { "count" : <num> }, "[650ms, 700ms)" : { "count" : <num> }, "[700ms, 750ms)" : { "count" : <num> }, "[750ms, 800ms)" : { "count" : <num> }, "[800ms, 850ms)" : { "count" : <num> }, "[850ms, 900ms)" : { "count" : <num> }, "[900ms, 950ms)" : { "count" : <num> }, "[950ms, 1000ms)" : { "count" : <num> }, "[1000ms, inf)" : { "count" : <num> }, "totalCount" : <num> }, "pools" : { "NetworkInterfaceTL-TaskExecutorPool-0" : { "poolInUse" : <num>, "poolAvailable" : <num>, "poolLeased" : <num>, "poolCreated" : <num>, "poolRefreshing" : <num>, "acquisitionWaitTimes" : <document>, // Added in MongoDB 6.3 "cfg1.example.net:27019" : { "inUse" : <num>, "available" : <num>, "leased" : <num>, "created" : <num>, "refreshing" : <num>, "acquisitionWaitTimes" : <document> // Added in MongoDB 6.3 }, }, "NetworkInterfaceTL-TaskExecutorPool-1" : { "poolInUse" : <num>, "poolAvailable" : <num>, "poolLeased" : <num>, "poolCreated" : <num>, "poolRefreshing" : <num>, "acquisitionWaitTimes" : <document>, // Added in MongoDB 6.3 "cfg1.example.net:27019" : { "inUse" : <num>, "available" : <num>, "leased" : <num>, "created" : <num>, "refreshing" : <num>, "acquisitionWaitTimes" : <document> // Added in MongoDB 6.3 } }, "NetworkInterfaceTL-TaskExecutorPool-2" : { "poolInUse" : <num>, "poolAvailable" : <num>, "poolLeased" : <num>, "poolCreated" : <num>, "poolRefreshing" : <num>, "acquisitionWaitTimes" : <document>, // Added in MongoDB 6.3 "cfg1.example.net:27019" : { "inUse" : <num>, "available" : <num>, "leased" : <num>, "created" : <num>, "refreshing" : <num>, "acquisitionWaitTimes" : <document> // Added in MongoDB 6.3 } }, "NetworkInterfaceTL-TaskExecutorPool-3" : { "poolInUse" : <num>, "poolAvailable" : <num>, "poolLeased" : <num>, "poolCreated" : <num>, "poolRefreshing" : <num>, "acquisitionWaitTimes" : <document>, // Added in MongoDB 6.3 "cfg1.example.net:27019" : { "inUse" : <num>, "available" : <num>, "leased" : <num>, "created" : <num>, "refreshing" : <num>, "acquisitionWaitTimes" : <document> // Added in MongoDB 6.3 } }, "NetworkInterfaceTL-ShardRegistry" : { "poolInUse" : <num>, "poolAvailable" : <num>, "poolLeased" : <num>, "poolCreated" : <num>, "poolRefreshing" : <num>, "acquisitionWaitTimes" : <document>, // Added in MongoDB 6.3 "cfg1.example.net:27019" : { "inUse" : <num>, "available" : <num>, "leased" : <num>, "created" : <num>, "refreshing" : <num>, "acquisitionWaitTimes" : <document> // Added in MongoDB 6.3 }, "cfg2.example.net:27019" : { "inUse" : <num>, "available" : <num>, "leased" : <num>, "created" : <num>, "refreshing" : <num>, "acquisitionWaitTimes" : <document> // Added in MongoDB 6.3 }, "cfg3.example.net:27019" : { "inUse" : <num>, "available" : <num>, "leased" : <num>, "created" : <num>, "refreshing" : <num>, "acquisitionWaitTimes" : <document> // Added in MongoDB 6.3 }, "shard1.example.net:27018" : { "inUse" : <num>, "available" : <num>, "leased" : <num>, "created" : <num>, "refreshing" : <num>, "acquisitionWaitTimes" : <document> // Added in MongoDB 6.3 }, "shard2.example.net:27018" : { "inUse" : <num>, "available" : <num>, "leased" : <num>, "created" : <num>, "refreshing" : <num>, "acquisitionWaitTimes" : <document> // Added in MongoDB 6.3 } }, "global" : { "poolInUse" : <num>, "poolAvailable" : <num>, "poolLeased" : <num>, "poolCreated" : <num>, "poolRefreshing" : <num>, "acquisitionWaitTimes" : <document>, // Added in MongoDB 6.3 "cfg3.example.net:27019" : { "inUse" : <num>, "available" : <num>, "leased" : <num>, "created" : <num>, "refreshing" : <num>, "acquisitionWaitTimes" : <document> // Added in MongoDB 6.3 }, "cfg1.example.net:27019" : { "inUse" : <num>, "available" : <num>, "leased" : <num>, "created" : <num>, "refreshing" : <num>, "acquisitionWaitTimes" : <document> // Added in MongoDB 6.3 }, "cfg2.example.net:27019" : { "inUse" : <num>, "available" : <num>, "leased" : <num>, "created" : <num>, "refreshing" : <num>, "acquisitionWaitTimes" : <document> // Added in MongoDB 6.3 }, "shard2.example.net:27018" : { "inUse" : <num>, "available" : <num>, "leased" : <num>, "created" : <num>, "refreshing" : <num>, "acquisitionWaitTimes" : <document> // Added in MongoDB 6.3 }, "shard1.example.net:27018" : { "inUse" : <num>, "available" : <num>, "leased" : <num>, "created" : <num>, "refreshing" : <num>, "acquisitionWaitTimes" : <document> // Added in MongoDB 6.3 } } }, "hosts" : { "cfg3.example.net:27019" : { "inUse" : <num>, "available" : <num>, "leased" : <num>, "created" : <num>, "refreshing" : <num>, "acquisitionWaitTimes" : <document> // Added in MongoDB 6.3 }, "cfg1.example.net:27019" : { "inUse" : <num>, "available" : <num>, "leased" : <num>, "created" : <num>, "refreshing" : <num>, "acquisitionWaitTimes" : <document> // Added in MongoDB 6.3 }, "cfg2.example.net:27019" : { "inUse" : <num>, "available" : <num>, "leased" : <num>, "created" : <num>, "refreshing" : <num>, "acquisitionWaitTimes" : <document> // Added in MongoDB 6.3 }, "shard2.example.net:27018" : { "inUse" : <num>, "available" : <num>, "leased" : <num>, "created" : <num>, "refreshing" : <num>, "acquisitionWaitTimes" : <document> // Added in MongoDB 6.3 }, "shard1.example.net:27018" : { "inUse" : <num>, "available" : <num>, "leased" : <num>, "created" : <num>, "refreshing" : <num>, "acquisitionWaitTimes" : <document> // Added in MongoDB 6.3 } }, "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パラメータを使用して設定できます。注意
If the
ShardingTaskExecutorPoolReplicaSetMatchingis set to"automatic", thereplicaSetMatchingStrategystill describes the actual policy being used, not"automatic". To find the value of theShardingTaskExecutorPoolReplicaSetMatching, usegetParameterwhich returns the value of the server parameter:db.adminCommand( { getParameter : 1, "ShardingTaskExecutorPoolReplicaSetMatching" : 1 } )
connPoolStats.acquisitionWaitTimesバージョン6.3の新機能。
ドキュメントは、
mongosからmongodへの接続を取得するためのリクエストの待機時間のヒストグラムを報告します。ドキュメントには、ミリ秒単位の時間範囲と各範囲内の接続リクエストの数が含まれています。
-infは負の無限大であり、範囲(-inf, 0ms)の接続リクエストは待機しませんでした。infは正の無限大であり、範囲[1000ms, inf)の接続リクエストが 1,000 ミリ秒以上の時間待機した。totalCountは、すべての時間範囲における接続リクエストの合計数です。
"acquisitionWaitTimes" : { "(-inf, 0ms)" : { "count" : <num> }, "[0ms, 50ms)" : { "count" : <num> }, "[50ms, 100ms)" : { "count" : <num> }, "[100ms, 150ms)" : { "count" : <num> }, "[150ms, 200ms)" : { "count" : <num> }, "[200ms, 250ms)" : { "count" : <num> }, "[250ms, 300ms)" : { "count" : <num> }, "[300ms, 350ms)" : { "count" : <num> }, "[350ms, 400ms)" : { "count" : <num> }, "[400ms, 450ms)" : { "count" : <num> }, "[450ms, 500ms)" : { "count" : <num> }, "[500ms, 550ms)" : { "count" : <num> }, "[550ms, 600ms)" : { "count" : <num> }, "[600ms, 650ms)" : { "count" : <num> }, "[650ms, 700ms)" : { "count" : <num> }, "[700ms, 750ms)" : { "count" : <num> }, "[750ms, 800ms)" : { "count" : <num> }, "[800ms, 850ms)" : { "count" : <num> }, "[850ms, 900ms)" : { "count" : <num> }, "[900ms, 950ms)" : { "count" : <num> }, "[950ms, 1000ms)" : { "count" : <num> }, "[1000ms, inf)" : { "count" : <num> }, "totalCount" : <num> }
connPoolStats.numClientConnection現在の
mongod/ インスタンスからシャーディングされた クラスターmongosまたは レプリカセット の他のノードに対するアクティブで保存されている送信 同期 接続の数を報告します。These connections are a part of a pool that is a subset of the data reported by
totalAvailable,totalCreated, andtotalInUse.
connPoolStats.numAScopedConnection現在の
mongod/ インスタンスからシャーディングされた クラスターmongosまたは レプリカセット の他のノードに対するアクティブで保存されている スコープ指定同期 接続の数を報告します。These connections are a part of a pool that is a subset of the data reported by
totalAvailable,totalCreated, andtotalInUse.
connPoolStats.pools接続プール別にグループ化された接続統計(使用中、利用可能/作成、またはリフレッシュ中)を報告します。
mongodまたはmongosには、送信接続プールの 2 つの異なるファミリーがあります。DBClient ベースのプール(「書込みパス」)と
networkInterfaceTL ベースのプール(「読み取りパス」)。
プールごとに、 コマンドは次のようなドキュメントを返します。
{ "poolInUse" : <num>, "poolAvailable" : <num>, "poolLeased" : <num>, "poolCreated" : <num>, "poolRefreshing" : <num>, "acquisitionWaitTimes" : <document>, // Added in MongoDB 6.3 "[host1]" : { "inUse" : <num>, "available" : <num>, "leased" : <num>, "created" : <num>, "refreshing" : <num>, "acquisitionWaitTimes" : <document> // Added in MongoDB 6.3 }, "[host2]" : { "inUse" : <num>, "available" : <num>, "leased" : <num>, "created" : <num>, "refreshing" : <num>, "acquisitionWaitTimes" : <document> // Added in MongoDB 6.3 }, ... } 注意
If there are no connections (in use/available/created/refreshing) for a particular pool, the
connPoolStatsdoes not return statistics for that pool.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.pools.[pool].acquisitionWaitTimesバージョン6.3の新機能。
Reports the wait times for requests to acquire a connection from
mongostomongod. For details, seeconnPoolStats.acquisitionWaitTimes.
connPoolStats.hosts接続統計(使用中、利用可能/作成、またはリフレッシュ中)をホスト別にグループ化して報告します。
現在の
mongod/ インスタンスとシャーディングされた クラスターmongosまたは レプリカセット の各ノードとの間の接続のレポートを表す ドキュメント が含まれます。connPoolStats.hosts.[host].leasedプールからホストされ、返されると予想されるホストへの接続の合計数を報告します。 これらの接続はリージョン中はアクティブではない可能性があり、関連メトリクスから除外されます。 これらの接続は、リージョン中は使用できなくなります。
connPoolStats.hosts.[host].acquisitionWaitTimesバージョン6.3の新機能。
Reports the wait times for requests to acquire a connection from
mongostomongod. For details, seeconnPoolStats.acquisitionWaitTimes.
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].ismasterReports
trueif thishostis the primary member of the replica set.
connPoolStats.replicaSets.[replicaSet].hosts[n].hiddenReports
trueif thishostis a hidden member of the replica set.
connPoolStats.replicaSets.[replicaSet].hosts[n].secondaryReports
trueif thishostis a secondary member of the replica set.
connPoolStats.replicaSets.[replicaSet].hosts[n].pingTimeMillisReports the ping time in milliseconds from the
mongosormongodto thishost.
connPoolStats.replicaSets.[replicaSet].hosts[n].tagsセットのこのメンバーにはタグが設定されている場合、
members[n].tagsを報告します。
ok ステータス フィールド、operationTime フィールド、および $clusterTime フィールドの詳細については、「応答」も参照してください。