You can find long running mongo queries with this
db.currentOp({"secs_running": {$gte: 20}})
That will list current operations that have been running at least 20 seconds and longer.
Look at that list that returns and find opid out of each element. Also read each element some of the queries there could be system processes (or at least it looked like it for me).
Then for each opid you want to kill run this
db.killOp(<OPIDHERE>);
The opid in my case was an int (a big one) so an example of what it looked like was this:
db.killOp(231321);
That should save you some reboots or service restarts!
Top comments (0)