shardConnPoolStats
定义
shardConnPoolStats自MongoDB 5.0起删除。 使用
connPoolStats代替。返回关于分片连接池中池化和缓存的连接的信息。该命令还返回关于连接池中每个线程的连接缓存的信息。
命令
shardConnPoolStats使用以下语法{ shardConnPoolStats: 1 } 分片连接池是特定于分片集群成员之间的连接。集群中的mongos实例使用连接池来执行客户端的读取和写入。集群中的mongod实例在执行
mapReduce时使用该池来查询其他分片上的临时集合。当集群需要连接时,MongoDB将从分片连接池中拉取一个连接到每个线程的连接缓存中。MongoDB在每次操作后将连接返回到连接池。
兼容性
此命令在以下环境中部署的部署中可用
MongoDB Atlas:云中MongoDB部署的全托管服务
重要
此命令不支持无服务器实例。有关更多信息,请参阅不受支持的命令。
MongoDB Enterprise:基于订阅、自行管理的MongoDB版本
MongoDB Community:源代码可用、免费使用并可自行管理的MongoDB版本
输出
shardConnPoolStats.hostsshardConnPoolStats.hosts.<host>.available该主机连接到
mongos可用的连接数。
shardConnPoolStats.hosts.<host>.created主机曾经创建的用于连接到
mongos的连接数。
shardConnPoolStats.replicaSets显示与副本集相关的特定信息。
shardConnPoolStats.replicaSets.<name>.host包含一个文档数组,报告每个副本集成员的信息。这些值来自副本集状态值。
shardConnPoolStats.replicaSets.<name>.host[n].ok该字段用于内部使用。当
mongos无法连接到实例或收到连接异常或错误时,报告false。
shardConnPoolStats.replicaSets.<name>.host[n].ismaster如果这个值为
true,则主机是该副本集的 主节点。
shardConnPoolStats.replicaSets.<name>.host[n].hidden如果这个值为
true,则主机是该副本集的 隐藏成员。
shardConnPoolStats.replicaSets.<name>.host[n].secondary如果这个值为
true,则主机是该副本集的 隐藏成员。如果这个值为
true,则主机是该副本集的 次要成员。
shardConnPoolStats.replicaSets.<name>.host[n].pingTimeMillis从
mongos到该成员的延迟,单位为毫秒。
shardConnPoolStats.replicaSets.<name>.host[n].tagstags文档包含用于副本集成员的用户定义的标签字段和值对。{ "<tag1>": "<string1>", "<tag2>": "<string2>",... } 对于读操作,您可以在读首选项中指定一个标签集,以将操作直接导向具有指定标签的副本集成员。
对于写操作,您可以使用写关注来创建自定义的,使用
settings.getLastErrorModes和settings.getLastErrorDefaults。
有关更多信息,请参阅配置副本集标签集。
shardConnPoolStats.totalCreatedmongos曾创建到集群其他成员的连接数。