Created
August 16, 2016 03:54
-
-
Save sean-lin/e21bfcadab8af5cea7f7ee17f12abd38 to your computer and use it in GitHub Desktop.
a script to kill query ops starting with a namespace from mongo database
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
killLongRunningOps = function(startswith) { | |
currOp = db.currentOp(); | |
currOp.inprog.forEach(function(op) { | |
if (op.op == "query" && op.ns.startsWith(startswith)) { | |
print("Killing opId: " + op.opid + " running over for secs: " + op.secs_running); | |
db.killOp(op.opid); | |
} | |
}); | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment