Definition定义
shardConnPoolStatsRemoved in MongoDB 5.0.在MongoDB 5.0中删除。Use请改用connPoolStatsinstead.connPoolStats。Returns information on the pooled and cached connections in the sharded connection pool. The command also returns information on the per-thread connection cache in the connection pool.返回分片连接池中池化和缓存连接的信息。该命令还返回连接池中每线程连接缓存的信息。TheshardConnPoolStatscommand uses the following syntax:shardConnPoolStats命令使用以下语法:{ shardConnPoolStats: 1 }The sharded connection pool is specific to connections between members in a sharded cluster.分片连接池特定于分片集群中成员之间的连接。The集群中的mongosinstances in a cluster use the connection pool to execute client reads and writes.mongos实例使用连接池来执行客户端读写操作。The集群中的mongodinstances in a cluster use the pool when issuingmapReduceto query temporary collections on other shards.mongod实例在发出mapReduce查询其他分片上的临时集合时使用该池。When the cluster requires a connection, MongoDB pulls a connection from the sharded connection pool into the per-thread connection cache. MongoDB returns the connection to the connection pool after every operation.当集群需要连接时,MongoDB会将连接从分片连接池拉入每线程连接缓存。MongoDB在每次操作后都会将连接返回到连接池。
Compatibility兼容性
This command is available in deployments hosted in the following environments:此命令在以下环境中托管的部署中可用:
- MongoDB Atlas
: The fully managed service for MongoDB deployments in the cloud:云中MongoDB部署的完全托管服务
- MongoDB Enterprise
: The subscription-based, self-managed version of MongoDB:MongoDB的基于订阅的自我管理版本 - MongoDB Community
: The source-available, free-to-use, and self-managed version of MongoDB:MongoDB的源代码可用、免费使用和自我管理版本
Output输出
shardConnPoolStats.hostsDisplays connection status for each config server, replica set, and standalone instance in the cluster.显示群集中每个配置服务器、副本集和独立实例的连接状态。shardConnPoolStats.hosts.<host>.availableThe number of connections available for this host to connect to the此主机可连接到mongos.mongos的连接数。
shardConnPoolStats.hosts.<host>.createdThe number of connections the host has ever created to connect to the主机为连接到mongos.mongos而创建的连接数。
shardConnPoolStats.replicaSetsDisplays information specific to replica sets.显示特定于副本集的信息。shardConnPoolStats.replicaSets.<name>.hostHolds an array of documents that report on each replica set member. These values derive from the replica set status values.保存一组报告每个副本集成员的文档。这些值来源于副本集状态值。shardConnPoolStats.replicaSets.<name>.host[n].addrThe host address in the format主机地址的格式为[hostname]:[port].[hostname]:[port]。
shardConnPoolStats.replicaSets.<name>.host[n].okThis field is for internal use. Reports此字段供内部使用。当falsewhen themongoseither cannot connect to instance or received a connection exception or error.mongos无法连接到实例或收到连接异常或错误时,报告false。
shardConnPoolStats.replicaSets.<name>.host[n].ismasterThe host is the replica set's primary if this is如果这是true.true,则主机是副本集的primary。
shardConnPoolStats.replicaSets.<name>.host[n].hiddenThe host is a hidden member of the replica set if this is如果这是true.true,则主机是副本集的隐藏成员。
shardConnPoolStats.replicaSets.<name>.host[n].secondaryThe host is a hidden member of the replica set if this is如果这是true.true,则主机是副本集的隐藏成员。The host is a secondary member of the replica set if this is如果这是true.true,则主机是副本集的secondary成员。
shardConnPoolStats.replicaSets.<name>.host[n].pingTimeMillisThe latency, in milliseconds, from the从mongosto this member.mongos到该成员的延迟(毫秒)。
shardConnPoolStats.replicaSets.<name>.host[n].tagsAtagsdocument contains user-defined tag field and value pairs for the replica set member.tags文档包含用户定义的标记字段和副本集成员的值对。{ "<tag1>": "<string1>", "<tag2>": "<string2>",... }For read operations, you can specify a tag set in the read preference to direct the operations to replica set member(s) with the specified tag(s).对于读取操作,您可以在读取首选项中指定一个标记集,以将操作定向到具有指定标记的副本集成员。For write operations, you can create a customize write concern using对于写入操作,您可以使用settings.getLastErrorModesandsettings.getLastErrorDefaults.settings.getLastErrorModes和settings.getLastErrorDefaults创建自定义写入关注。
For more information, see Configure Replica Set Tag Sets.有关详细信息,请参阅配置副本集标记集。Tip
shardConnPoolStats.createdByTypeThe number connections in the cluster's connection pool.群集连接池中的连接数。shardConnPoolStats.createdByType.masterThe number of connections to a shard.与分片的连接数。
shardConnPoolStats.createdByType.setThe number of connections to a replica set.与副本集的连接数。
shardConnPoolStats.createdByType.syncThe number of connections to the config database.与配置数据库的连接数。
shardConnPoolStats.totalAvailableThe number of connections available from the从mongosto the config servers, replica sets, and standalonemongodinstances in the cluster.mongos到集群中的配置服务器、副本集和独立mongod实例的可用连接数。
shardConnPoolStats.totalCreatedThe number of connections themongoshas ever created to other members of the cluster.mongos与集群其他成员之间创建的连接数量。
shardConnPoolStats.threadsDisplays information on the per-thread connection cache.显示每线程连接缓存的信息。shardConnPoolStats.threads.hostsDisplays each incoming client connection. For a显示每个传入的客户端连接。对于mongos, this array field displays one document per incoming client thread. For amongod, the array displays one entry per incoming shardedmapReduceclient thread.mongos,此数组字段为每个传入的客户端线程显示一个文档。对于mongod,数组为每个传入的分片mapReduce客户端线程显示一个条目。shardConnPoolStats.threads.hosts.hostThe host using the connection. The host can be a config server, replica set, or standalone instance.使用连接的主机。主机可以是配置服务器、副本集或独立实例。
shardConnPoolStats.threads.hosts.createdThe number of times the host pulled a connection from the pool.主机从池中拉取连接的次数。
shardConnPoolStats.threads.hosts.availThe thread's availability.线程的可用性。
shardConnPoolStats.threads.seenNSThe namespaces used on this connection thus far.到目前为止,此连接上使用的命名空间。