mongodb的mongostat
[work@xxx bin]$ mongostat --port 28042 --authenticationDatabase admin -umongodb_dba -p123456
insert query update delete getmore command dirty used flushes vsize res qrw arw net_in net_out conn set repl time *0 *0 *0 *0 0 14|0 0.0% 0.0% 0 1.39G 72.0M 0|0 1|0 2.04k 78.3k 9 glc-test SEC Nov 26 17:01:18.736 *0 *0 *0 *0 0 14|0 0.0% 0.0% 0 1.39G 72.0M 0|0 1|0 1.99k 76.4k 9 glc-test SEC Nov 26 17:01:19.736 *0 *0 *0 *0 0 14|0 0.0% 0.0% 0 1.39G 72.0M 0|0 1|0 1.99k 76.5k 9 glc-test SEC Nov 26 17:01:20.735 *0 *0 *0 *0 1 22|0 0.0% 0.0% 0 1.39G 72.0M 0|0 1|0 2.84k 115k 9 glc-test SEC Nov 26 17:01:21.734 *0 *0 *0 *0 0 13|0 0.0% 0.0% 0 1.39G 72.0M 0|0 1|0 1.98k 76.2k 9 glc-test SEC Nov 26 17:01:22.736 *0 *0 *0 *0 0 14|0 0.0% 0.0% 0 1.39G 72.0M 0|0 1|0 1.99k 76.7k 9 glc-test SEC Nov 26 17:01:23.733 *0 *0 *0 *0 0 13|0 0.0% 0.0% 0 1.39G 72.0M 0|0 1|0 1.99k 76.4k 9 glc-test SEC Nov 26 17:01:24.734 *0 *0 *0 *0 1 22|0 0.0% 0.0% 0 1.39G 72.0M 0|0 1|0 2.83k 115k 9 glc-test SEC Nov 26 17:01:25.734 *0 *0 *0 *0 0 13|0 0.0% 0.0% 0 1.39G 72.0M 0|0 1|0 1.99k 76.4k 9 glc-test SEC Nov 26 17:01:26.734 *0 *0 *0 *0 0 20|0 0.0% 0.0% 1 1.39G 72.0M 0|0 1|0 2.45k 79.8k 9 glc-test SEC Nov 26 17:01:27.733 insert query update delete getmore command dirty used flushes vsize res qrw arw net_in net_out conn set repl time *0 *0 *0 *0 0 13|0 0.0% 0.0% 0 1.39G 72.0M 0|0 1|0 1.99k 76.4k 9 glc-test SEC Nov 26 17:01:28.734 *0 *0 *0 *0 1 22|0 0.0% 0.0% 0 1.39G 72.0M 0|0 1|0 2.83k 115k 9 glc-test SEC Nov 26 17:01:29.733 *0 *0 *0 *0 0 13|0 0.0% 0.0% 0 1.39G 72.0M 0|0 1|0 1.99k 76.4k 9 glc-test SEC Nov 26 17:01:30.734 *0 *0 *0 *0 0 13|0 0.0% 0.0% 0 1.39G 72.0M 0|0 1|0 1.98k 76.3k 9 glc-test SEC Nov 26 17:01:31.735 *0 *0 *0 *0 0 15|0 0.0% 0.0% 0 1.39G 72.0M 0|0 1|0 2.04k 76.7k 10 glc-test SEC Nov 26 17:01:32.735 *0 *0 *0 *0 1 22|0 0.0% 0.0% 0 1.39G 72.0M 0|0 1|0 2.83k 115k 10 glc-test SEC Nov 26 17:01:33.734 *0 *0 *0 *0 0 14|0 0.0% 0.0% 0 1.39G 72.0M 0|0 1|0 1.99k 76.5k 10 glc-test SEC Nov 26 17:01:34.734 *0 *0 *0 *0 0 13|0 0.0% 0.0% 0 1.39G 72.0M 0|0 1|0 1.99k 76.4k 10 glc-test SEC Nov 26 17:01:35.734 *0 *0 *0 *0 0 14|0 0.0% 0.0% 0 1.39G 72.0M 0|0 1|0 1.99k 76.5k 10 glc-test SEC Nov 26 17:01:36.733 *0 *0 *0 *0 0 21|0 0.0% 0.0% 0 1.39G 72.0M 0|0 1|0 2.83k 115k 10 glc-test SEC Nov 26 17:01:37.734
实时数据库状态,读写、加锁、索引命中、缺页中断、读写等待队列等情况。
每秒刷新一次状态值,并能提供良好的可读性,通过这些参数可以观察到MongoDB系统整体性能情况。
参数说明:
参数 |
参数说明 |
insert |
每秒插入量 |
query |
每秒查询量 |
update |
每秒更新量 |
delete |
每秒删除量 |
conn |
当前连接数 |
qr|qw |
客户端查询排队长度(读|写)最好为0,如果有堆积,数据库处理慢。 |
ar|aw |
活跃客户端数量(读|写) |
time |
当前时间 |
脚本:sh mgstat.sh hostname port
[work@xxx mgdb]$ cat mgstat.sh #!/bin/bash mgtop_bin="/home/work/mongodb/4.0/mongostat" hostname=$1 port=$2 ${mgtop_bin} --uri="mongodb://mongodb_dba:123456@${hostname}:${port}/?authSource=admin"
#############################################
igoodful@qq.com