Friday, August 3, 2018

Activity and Lock Monitoring


db.currentOp()


Long Running queries:
=================
query active on particular db and more than x amount of seconds

db.currentOp(    {      "active" : true,      "secs_running" : { "$gt" : 30000 },      "ns" : /^qptdb01\./    } )

Active Indexing Operations
=====================

db.currentOp(     {       $or: [         { op: "command", "query.createIndexes": { $exists: true } },         { op: "none", ns: /\.system\.indexes\b/ }       ]     } )

Write waiting for lock
================

db.currentOp(    {      "waitingForLock" : true,      $or: [         { "op" : { "$in" : [ "insert", "update", "remove" ] } },         { "query.findandmodify": { $exists: true } }     ]    } )

All the active transactions waiting to complete
===================================
db.currentOp(    {      "active" : true,      "numYields" : 0,      "waitingForLock" : false    } )

No comments:

Post a Comment