Press "Enter" to skip to content

mongostat/mongotop

/yourpath/mongodb/bin/mongostat --host=1.2.3.4 --port=10000(这里的端口为mongos端口)
insert query update delete getmore command flushes mapped vsize res faults qr|qw ar|aw netIn netOut conn set repl time
159 18 7 *0 0 38|0 0 966.0M 149.0M 0 0|0 0|0 137k 40k 284 RTR 2018-01-15T16:08:26+08:00
insert 一秒内的插入数,如果有*,表示这是复制操作
query 一秒内的查询数
update 一秒内的更新数
delete 一秒内的删除数
getmore 一秒内的执行getmore的次数
10条简单的查询可能比一条复杂的查询速度还快, 所以数值的大小,意义并不大。但至少可以知道,现在是否在处理查询,是否在插入。
command 一秒内执行的命令数
比如批量插入,只认为是一条命令。 意义不大。如果是slave,会显示两个值, local|replicated,通过这两个数值的比较,或许可以看出点问题。
flushes 一秒内flush的次数(每秒执行fsync将数据写入硬盘的次数)
一般都是0,或者1,通过计算两个1之间的间隔时间,可以大致了解多长时间flush一次。flush开销是很大的,如果频繁的flush,可能就要找找原因了。
mapped 映射到内存的数据大小
vsize 占用的虚拟内存大小
res 占用的物理内存大小
faults 每秒访问失败数(只有Linux有),数据被交换出物理内存,放到swap。不要超过100,否则就是机器内存太小,造成频繁swap写入。此时要升级内存或者扩展
qr|qw 等待读写的队列长度
ar|aw 正在读写的数量
netIn MongoDB实例接收到的网络流量,用字节bytes表示
netOut MongoDB实例发送出去的网络流量,用字节bytes表示
conn 打开的连接数总数
set replica set的名称
repl replica set的状态 PRI 表示是Primary,SEC表示是Secondary
time 当前时间
inserts - # of inserts per second (* means replicated op)
query - # of queries per second
update - # of updates per second
delete - # of deletes per second
getmore - # of get mores (cursor batch) per second
command - # of commands per second, on a slave its local|replicated
flushes - # of fsync flushes per second
mapped - amount of data mmaped (total data size) megabytes
vsize - virtual size of process in megabytes
res - resident size of process in megabytes
faults - # of pages faults per sec
locked - name of and percent time for most locked database
idx miss - percent of btree page misses (sampled)
qr|qw - queue lengths for clients waiting (read|write)
ar|aw - active clients (read|write)
netIn - network traffic in - bits
netOut - network traffic out - bits
conn - number of open connections
set - replica set name
repl - replication type
PRI - primary (master)
SEC - secondary
REC - recovering
UNK - unknown
SLV - slave
RTR - mongos process ("router")

/yourpath/mongodb/bin/mongotop --host=1.2.3.4 --port=20000(这里的端口为某个分片的端口)
2018-01-15T17:24:36.188+0800 connected to: 1.2.3.4:20000

ns total read write 2018-01-15T17:24:37+08:00
testdb.collection1 7ms 6ms 1ms
testdb.collection2 3ms 3ms 0ms
local.oplog.rs 1ms 1ms 0ms
admin.system.roles 0ms 0ms 0ms
admin.system.version 0ms 0ms 0ms
config.system.profile 0ms 0ms 0ms
testdb.collection3 0ms 0ms 0ms

Be First to Comment

发表回复

您的电子邮箱地址不会被公开。 必填项已用*标注