AI エージェント向け: ドキュメントインデックスは https://www.mongodb.com/ja-jp/docs/llms.txt で利用できます。すべてのページの markdown バージョンは、いずれかの URL パスに .md を追加することで利用できます。
Docs Menu

connectPoolStats(データベースコマンド)

connPoolStats

The command connPoolStats returns 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> } ) メソッドを使用します。

注意

connPoolStats only returns meaningful results for mongos instances and for mongod instances 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 hosts field displays the information aggregated by host.

  • The pools field 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 ShardingTaskExecutorPoolReplicaSetMatching is set to "automatic", the replicaSetMatchingStrategy still describes the actual policy being used, not "automatic". To find the value of the ShardingTaskExecutorPoolReplicaSetMatching, use getParameter which 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, and totalInUse.

connPoolStats.numAScopedConnection

現在のmongod / インスタンスからシャーディングされた クラスターmongos または レプリカセット の他のノードに対するアクティブで保存されている スコープ指定同期 接続の数を報告します。

These connections are a part of a pool that is a subset of the data reported by totalAvailable, totalCreated, and totalInUse.

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 connPoolStats does 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.global

DBClient ベースのプール統計を表示します。

connPoolStats.pools.[pool].poolWasNeverUsed

この接続プール内の未使用で閉じられた接続の数を表示。

connPoolStats.pools.[pool].acquisitionWaitTimes

バージョン6.3の新機能。

Reports the wait times for requests to acquire a connection from mongos to mongod. For details, see connPoolStats.acquisitionWaitTimes.

connPoolStats.hosts

接続統計(使用中、利用可能/作成、またはリフレッシュ中)をホスト別にグループ化して報告します。

現在のmongod / インスタンスとシャーディングされた クラスターmongos または レプリカセット の各ノードとの間の接続のレポートを表す ドキュメント が含まれます。

connPoolStats.hosts.[host].available

[host]への接続に利用可能な接続の合計数を報告します。

connPoolStats.hosts.[host].leased

プールからホストされ、返されると予想されるホストへの接続の合計数を報告します。 これらの接続はリージョン中はアクティブではない可能性があり、関連メトリクスから除外されます。 これらの接続は、リージョン中は使用できなくなります。

connPoolStats.hosts.[host].created

作成された[host]への接続数を報告します。

connPoolStats.hosts.[host].inUse

現在使用中の[host]への接続数を報告します。

connPoolStats.hosts.[host].wasNeverUsed

hostから閉じたシャーディングされたクラスターまたはレプリカセットの他のノードへの送信接続の合計数を報告します。

connPoolStats.hosts.[host].acquisitionWaitTimes

バージョン6.3の新機能。

Reports the wait times for requests to acquire a connection from mongos to mongod. For details, see connPoolStats.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].ok

次の場合にfalseを報告します。

  • 現在のmongosまたはmongodは インスタンスに接続できません。

  • 現在のmongosまたはmongodが接続の例外またはエラーを受信した。

このフィールドは内部で使用します。

connPoolStats.replicaSets.[replicaSet].hosts[n].ismaster

Reports true if this host is the primary member of the replica set.

connPoolStats.replicaSets.[replicaSet].hosts[n].hidden

Reports true if this host is a hidden member of the replica set.

connPoolStats.replicaSets.[replicaSet].hosts[n].secondary

Reports true if this host is a secondary member of the replica set.

connPoolStats.replicaSets.[replicaSet].hosts[n].pingTimeMillis

Reports the ping time in milliseconds from the mongos or mongod to this host.

connPoolStats.replicaSets.[replicaSet].hosts[n].tags

セットのこのメンバーにはタグが設定されている場合、 members[n].tagsを報告します。

ok ステータス フィールド、operationTime フィールド、および $clusterTime フィールドの詳細については、「応答」も参照してください。

host

このページを評価