mongostat和mongotop对mongodb数据库运行状态进行监控


--mongostat工具是mongdb自带的监控工具,可以用来监控mongodb当前状态下的运行情况:

[root@slave2 ~]# /usr/local/mongodb341/bin/mongostat 2
insert query update delete getmore command dirty used flushes vsize   res qrw arw net_in net_out conn                time
    *0    *0     *0     *0       0     1|0  0.0% 0.0%       0  439M 56.0M 0|0 0|0    79b   22.5k    2 Dec 29 13:22:35.349
    *0    *0     *0     *0       0     1|0  0.0% 0.0%       0  439M 56.0M 0|0 0|0    79b   22.5k    2 Dec 29 13:22:37.349
    *0    *0     *0     *0       0     0|0  0.0% 0.0%       0  439M 56.0M 0|0 0|0    78b   22.5k    2 Dec 29 13:22:39.350
    *0    *0     *0     *0       0     1|0  0.0% 0.0%       0  439M 56.0M 0|0 0|0    79b   22.5k    2 Dec 29 13:22:41.349
    *0    *0     *0     *0       0     1|0  0.0% 0.0%       0  439M 56.0M 0|0 0|0    79b   22.5k    2 Dec 29 13:22:43.348
    *0    *0     *0     *0       0     0|0  0.0% 0.0%       0  439M 56.0M 0|0 0|0    78b   22.5k    2 Dec 29 13:22:45.349
    *0    *0     *0     *0       0     0|0  0.0% 0.0%       0  439M 56.0M 0|0 0|0    78b   22.5k    2 Dec 29 13:22:47.350
    *0    *0     *0     *0       0     1|0  0.0% 0.0%       0  439M 56.0M 0|0 0|0   105b   22.5k    2 Dec 29 13:22:49.352

--mongotop工具是mongodb自带的top监控工具,可以用来监控当前mongodb数据库哪些资源占用资源较多,对于优化具有参考作用:

[root@slave2 ~]# /usr/local/mongodb341/bin/mongotop 2
2016-12-29T13:24:35.530+0800    connected to: 127.0.0.1

                  ns    total    read    write    2016-12-29T13:24:37+08:00
  admin.system.roles      0ms     0ms      0ms                            
  admin.system.users      0ms     0ms      0ms                            
admin.system.version      0ms     0ms      0ms                            
             dbk.col      0ms     0ms      0ms                            
            dbk.test      0ms     0ms      0ms                            
          dbking.col      0ms     0ms      0ms                            
         dbking.test      0ms     0ms      0ms                            
           local.col      0ms     0ms      0ms                            
   local.startup_log      0ms     0ms      0ms                            
local.system.replset      0ms     0ms      0ms                            

                  ns    total    read    write    2016-12-29T13:24:39+08:00
  admin.system.roles      0ms     0ms      0ms                            
  admin.system.users      0ms     0ms      0ms                            
admin.system.version      0ms     0ms      0ms                            
             dbk.col      0ms     0ms      0ms                            
            dbk.test      0ms     0ms      0ms                            
          dbking.col      0ms     0ms      0ms                            
         dbking.test      0ms     0ms      0ms                            
           local.col      0ms     0ms      0ms                            
   local.startup_log      0ms     0ms      0ms                            
local.system.replset      0ms     0ms      0ms                            

原文地址:https://www.cnblogs.com/wcwen1990/p/6655444.html