当前位置:Gxlcms > 数据库问题 > MongoDB进程查看方法

MongoDB进程查看方法

时间:2021-07-01 10:21:17 帮助过:130人阅读

current" : 233, "available" : 50967, "totalCreated" : NumberLong(191495) }

--  current:当前连接数
--  available:可用连接数
--  TotalCreated:累计创建线程数


(2)MongoDB当前正在执行的操作

  1. db.currentOP()

结果如下:

  1. <span style="color: rgb(0, 0, 0);">{
  2. </span><span style="color: rgb(128, 0, 0);">"</span><span style="color: rgb(128, 0, 0);">inprog</span><span style="color: rgb(128, 0, 0);">"</span><span style="color: rgb(0, 0, 0);"> : [
  3. {
  4. </span><span style="color: rgb(128, 0, 0);">"</span><span style="color: rgb(128, 0, 0);">opid</span><span style="color: rgb(128, 0, 0);">"</span> : <span style="color: rgb(128, 0, 128);">555344731</span><span style="color: rgb(0, 0, 0);">,
  5. </span><span style="color: rgb(128, 0, 0);">"</span><span style="color: rgb(128, 0, 0);">active</span><span style="color: rgb(128, 0, 0);">"</span> : <span style="color: rgb(0, 0, 255);">true</span><span style="color: rgb(0, 0, 0);">,
  6. </span><span style="color: rgb(128, 0, 0);">"</span><span style="color: rgb(128, 0, 0);">secs_running</span><span style="color: rgb(128, 0, 0);">"</span> : <span style="color: rgb(128, 0, 128);">4</span><span style="color: rgb(0, 0, 0);">,
  7. </span><span style="color: rgb(128, 0, 0);">"</span><span style="color: rgb(128, 0, 0);">microsecs_running</span><span style="color: rgb(128, 0, 0);">"</span> : NumberLong(<span style="color: rgb(128, 0, 128);">4245011</span><span style="color: rgb(0, 0, 0);">),
  8. </span><span style="color: rgb(128, 0, 0);">"</span><span style="color: rgb(128, 0, 0);">op</span><span style="color: rgb(128, 0, 0);">"</span> : <span style="color: rgb(128, 0, 0);">"</span><span style="color: rgb(128, 0, 0);">getmore</span><span style="color: rgb(128, 0, 0);">"</span><span style="color: rgb(0, 0, 0);">,
  9. </span><span style="color: rgb(128, 0, 0);">"</span><span style="color: rgb(128, 0, 0);">ns</span><span style="color: rgb(128, 0, 0);">"</span> : <span style="color: rgb(128, 0, 0);">"</span><span style="color: rgb(128, 0, 0);">local.oplog.$main</span><span style="color: rgb(128, 0, 0);">"</span><span style="color: rgb(0, 0, 0);">,
  10. </span><span style="color: rgb(128, 0, 0);">"</span><span style="color: rgb(128, 0, 0);">query</span><span style="color: rgb(128, 0, 0);">"</span><span style="color: rgb(0, 0, 0);"> : {
  11. </span><span style="color: rgb(128, 0, 0);">"</span><span style="color: rgb(128, 0, 0);">ts</span><span style="color: rgb(128, 0, 0);">"</span><span style="color: rgb(0, 0, 0);"> : {
  12. </span><span style="color: rgb(128, 0, 0);">"</span><span style="color: rgb(128, 0, 0);">$gte</span><span style="color: rgb(128, 0, 0);">"</span> : Timestamp(<span style="color: rgb(128, 0, 128);">1587629847</span>, <span style="color: rgb(128, 0, 128);">1</span><span style="color: rgb(0, 0, 0);">)
  13. }
  14. },
  15. </span><span style="color: rgb(128, 0, 0);">"</span><span style="color: rgb(128, 0, 0);">client</span><span style="color: rgb(128, 0, 0);">"</span> : <span style="color: rgb(128, 0, 0);">"</span><span style="color: rgb(128, 0, 0);">10.1.70.58:39730</span><span style="color: rgb(128, 0, 0);">"</span><span style="color: rgb(0, 0, 0);">,
  16. </span><span style="color: rgb(128, 0, 0);">"</span><span style="color: rgb(128, 0, 0);">desc</span><span style="color: rgb(128, 0, 0);">"</span> : <span style="color: rgb(128, 0, 0);">"</span><span style="color: rgb(128, 0, 0);">conn138331</span><span style="color: rgb(128, 0, 0);">"</span><span style="color: rgb(0, 0, 0);">,
  17. </span><span style="color: rgb(128, 0, 0);">"</span><span style="color: rgb(128, 0, 0);">threadId</span><span style="color: rgb(128, 0, 0);">"</span> : <span style="color: rgb(128, 0, 0);">"</span><span style="color: rgb(128, 0, 0);">0x7e9b25584700</span><span style="color: rgb(128, 0, 0);">"</span><span style="color: rgb(0, 0, 0);">,
  18. </span><span style="color: rgb(128, 0, 0);">"</span><span style="color: rgb(128, 0, 0);">connectionId</span><span style="color: rgb(128, 0, 0);">"</span> : <span style="color: rgb(128, 0, 128);">138331</span><span style="color: rgb(0, 0, 0);">,
  19. </span><span style="color: rgb(128, 0, 0);">"</span><span style="color: rgb(128, 0, 0);">waitingForLock</span><span style="color: rgb(128, 0, 0);">"</span> : <span style="color: rgb(0, 0, 255);">false</span><span style="color: rgb(0, 0, 0);">,
  20. </span><span style="color: rgb(128, 0, 0);">"</span><span style="color: rgb(128, 0, 0);">numYields</span><span style="color: rgb(128, 0, 0);">"</span> : <span style="color: rgb(128, 0, 128);">0</span><span style="color: rgb(0, 0, 0);">,
  21. </span><span style="color: rgb(128, 0, 0);">"</span><span style="color: rgb(128, 0, 0);">lockStats</span><span style="color: rgb(128, 0, 0);">"</span><span style="color: rgb(0, 0, 0);"> : {
  22. </span><span style="color: rgb(128, 0, 0);">"</span><span style="color: rgb(128, 0, 0);">timeLockedMicros</span><span style="color: rgb(128, 0, 0);">"</span><span style="color: rgb(0, 0, 0);"> : {
  23. </span><span style="color: rgb(128, 0, 0);">"</span><span style="color: rgb(128, 0, 0);">r</span><span style="color: rgb(128, 0, 0);">"</span> : NumberLong(<span style="color: rgb(128, 0, 128);">364</span><span style="color: rgb(0, 0, 0);">),
  24. </span><span style="color: rgb(128, 0, 0);">"</span><span style="color: rgb(128, 0, 0);">w</span><span style="color: rgb(128, 0, 0);">"</span> : NumberLong(<span style="color: rgb(128, 0, 128);">0</span><span style="color: rgb(0, 0, 0);">)
  25. },
  26. </span><span style="color: rgb(128, 0, 0);">"</span><span style="color: rgb(128, 0, 0);">timeAcquiringMicros</span><span style="color: rgb(128, 0, 0);">"</span><span style="color: rgb(0, 0, 0);"> : {
  27. </span><span style="color: rgb(128, 0, 0);">"</span><span style="color: rgb(128, 0, 0);">r</span><span style="color: rgb(128, 0, 0);">"</span> : NumberLong(<span style="color: rgb(128, 0, 128);">16</span><span style="color: rgb(0, 0, 0);">),
  28. </span><span style="color: rgb(128, 0, 0);">"</span><span style="color: rgb(128, 0, 0);">w</span><span style="color: rgb(128, 0, 0);">"</span> : NumberLong(<span style="color: rgb(128, 0, 128);">0</span><span style="color: rgb(0, 0, 0);">)
  29. }
  30. }
  31. }
  32. ]
  33. }</span>

--  opid:进程号
--  active:是否活跃状态
--  secs_running:操作运行秒数
--  microsecs_running:操作运行微秒数
--  op:操作类型,包括(insert/update/query/remove/getmore/command)
--  ns:命名空间
--  query:查询语句
--  client:连接的客户端信息
--  desc:描述信息
--  threadId:线程id
--  connectionId:连接id
--  waitingForLock:是否等待获取锁
--  lockStats.timeLockedMicros.r:持有读锁的时间(微秒)
--  lockStats.timeLockedMicros.w:持有写锁的时间(微秒)
--  lockStats.timeAcquiringMicros.r:请求读锁的时间(微秒)
--  lockStats.timeAcquiringMicros.2:请求写锁的时间(微秒)


(3)MongoDB杀死正在执行的进程

  1. db.killOp(opid);



【完】

MongoDB进程查看方法

标签:waiting   none   code   time   ber   for   ros   client   get   

人气教程排行