MongoDB性能监控(2)—mongotop命令

2018-07-20  本文已影响0人  PennyHung

1、Mongotop命令简介

mongotop也是mongodb下的一个内置工具,mongotop提供了一个方法,用来跟踪一个MongoDB的实例,查看哪些大量的时间花费在读取和写入数据。 mongotop提供每个集合的水平的统计数据。默认情况下,mongotop返回值的每一秒。


2、帮助命令及参数说明

[root@ggtest1 bin]# mongotop --help

Usage:

mongotop

Monitor basic usage statistics for each collection.

See http://docs.mongodb.org/manual/reference/program/mongotop/ for more information.

general options:

--help                                      显示帮助信息

--version                                  显示版本信息

verbosity options:

-v, --verbose=              详细模式,多个v可以增加详细输出,如-vvvv

--quiet                                    隐藏所有日志输出

connection options:

-h, --host=            主机信息(主机名或IP地址)

--port=                    端口

kerberos options:

--gssapiServiceName=          service name to use when authenticating using GSSAPI/Kerberos ('mongodb' by default)

--gssapiHostName=                hostname to use when authenticating using GSSAPI/Kerberos (remote server's address by default)

ssl options:

--ssl                                      connect to a mongod or mongos that has ssl enabled

--sslCAFile=                      the .pem file containing the root certificate chain from the certificate authority

--sslPEMKeyFile=                  the .pem file containing the certificate and key

--sslPEMKeyPassword=              the password to decrypt the sslPEMKeyFile, if necessary

--sslCRLFile=                    the .pem file containing the certificate revocation list

--sslAllowInvalidCertificates              bypass the validation for server certificates

--sslAllowInvalidHostnames                  bypass the validation for server name

--sslFIPSMode                              use FIPS mode of the installed openssl library

authentication options:

-u, --username=                      指定链接的用户名

-p, --password=                      指定链接的用户密码

--authenticationDatabase=    指定用户认证库

--authenticationMechanism=      指定认证机制

output options:

--locks                                    查看数据库锁情况

-n, --rowcount=                          指定显示行数

--json                                      输出格式为JSON


3、mongotop命令用法:

启动Mongod服务,进入到安装MongoDB目录下的bin目录, 然后输入mongotop命令,如下所示:

[root@ggtest1 bin]# mongotop -h localhost:27018

2016-10-28T16:03:28.526+0800    connected to: localhost:27018

ns    total    read    write    2016-10-28T16:03:29+08:00

local.oplog.rs      1ms    1ms      0ms

admin.system.roles      0ms    0ms      0ms

admin.system.users      0ms    0ms      0ms

admin.system.version      0ms    0ms      0ms

admin.test      0ms    0ms      0ms

admin.users      0ms    0ms      0ms

henry.test      0ms    0ms      0ms

joyce.microblog      0ms    0ms      0ms

joyce.sessions      0ms    0ms      0ms

[root@ggtest1 bin]# mongotop -h localhost:27018 --locks


4、输出字段说明:

ns:包含数据库命名空间,后者结合了数据库名称和集合。

db:包含数据库的名称。名为 . 的数据库针对全局锁定,而非特定数据库。

total:mongod在这个命令空间上花费的总时间。

read:在这个命令空间上mongod执行读操作花费的时间。

write:在这个命名空间上mongod进行写操作花费的时间。

參考連結 : 

http://forum.foxera.com/mongodb/topic/110/mongodb%E6%80%A7%E8%83%BD%E7%9B%91%E6%8E%A7-2-mongotop%E5%91%BD%E4%BB%A4

上一篇 下一篇

猜你喜欢

热点阅读