shardConnPoolStats
在本页面
Definition
shardConnPoolStats
- 返回有关分片连接池中池化和缓存的连接的信息。该命令还返回有关连接池中每线程连接缓存的信息。
shardConnPoolStats命令使用以下语法:
{ shardConnPoolStats: 1 }
分片连接池特定于分片群集中成员之间的连接。群集中的mongos实例使用连接池执行 Client 端读取和写入。发出mapReduce来查询其他分片上的临时集合时,群集中的mongod实例使用池。
当集群需要连接时,MongoDB 将连接从分片连接池拉入每个线程的连接缓存。每次操作后,MongoDB 会将连接返回到连接池。
Output
-
shardConnPoolStats.hosts.<host>.
available
{#shardConnPoolStats.hosts.<host>.available}- 可用于此主机连接到mongos的连接数。
-
shardConnPoolStats.hosts.<host>.
created
{#shardConnPoolStats.hosts.<host>.created}- 主机已创建的用于连接到mongos的连接数。
-
shardConnPoolStats.replicaSets.<name>.
host
{#shardConnPoolStats.replicaSets.<name>.host}- 包含一系列报告每个副本集成员的文档。这些值来自副本集状态值。
-
shardConnPoolStats.replicaSets.<name>.host[n].
addr
{#shardConnPoolStats.replicaSets.<name>.host[n].addr}
-主机地址,格式为[hostname]:[port]
。 -
shardConnPoolStats.replicaSets.<name>.host[n].
ok
{#shardConnPoolStats.replicaSets.<name>.host[n].ok}
-此字段仅供内部使用。当mongos无法连接到实例或收到连接异常或错误时报告false
。 -
shardConnPoolStats.replicaSets.<name>.host[n].
ismaster
{#shardConnPoolStats.replicaSets.<name>.host[n].ismaster}
-主机是副本集的primary(如果它是true
)。 -
shardConnPoolStats.replicaSets.<name>.host[n].
hidden
{#shardConnPoolStats.replicaSets.<name>.host[n].hidden}
-主机是副本集的hidden member(如果它是true
)。 -
shardConnPoolStats.replicaSets.<name>.host[n].
secondary
{#shardConnPoolStats.replicaSets.<name>.host[n].secondary}
-主机是副本集的hidden member(如果它是true
)。
如果主机是true
,则主机是副本集的secondary成员。
-
shardConnPoolStats.replicaSets.<name>.host[n].
pingTimeMillis
{#shardConnPoolStats.replicaSets.<name>.host[n].pingTimeMillis}
-从mongos到此成员的延迟(以毫秒为单位)。 -
shardConnPoolStats.replicaSets.<name>.host[n].
tags
{#shardConnPoolStats.replicaSets.<name>.host[n].tags}
-tags
文档包含用户定义的标记字段和副本集成员的值对。
{ "<tag1>": "<string1>", "<tag2>": "<string2>",... }
-
对于读取操作,您可以在read preference中指定一个标签集,以将操作定向到具有指定标签的副本集成员。
-
对于写操作,可以使用settings.getLastErrorModes和settings.getLastErrorDefaults创建自定义write concern。
有关更多信息,请参见配置副本集标记集。
See also