例1:查询所有正在等待锁的写操作
db.currentOp(
{
"waitingForLock" : true,
$or: [
{
"op" : {
"$in" : [ "insert", "update", "remove" ] } },
{
"query.findandmodify": {
$exists: true } }
]
}
)
例2:查询所有操作db1并且执行时间已超过3s的请求
db.currentOp(
{
"active" : true,
"secs_running" : {
"$gt" : 3 },
"ns" : /^db1\./
}
)
currentOp的过滤条件包括
请求操作类型,insert、update、delete…
请求对应的connectionId,threadId
请求是否正在等待锁
请求执行时间
请求操作的DB或collection
请求query的内容
…
killOp
currentOp的输出结果里,每个请求包含一个opid字段,有了opid,就可以发送killOp来干掉对应的请求。
db.killOp(opid)
mongo kill慢查询
猜你喜欢
转载自blog.csdn.net/qq_41588098/article/details/128034061
今日推荐
周排行