MongoDB性能优化系列:查看当前正在执行的操作

查看MongoDB正在执行哪些操作

rs1:PRIMARY> db.currentOp()
{
        "inprog" : [
                {
                        "desc" : "conn111911",
                        "threadId" : "140075999385344",
                        "connectionId" : 111911,
                        "client" : "10.62.124.34:37476",
                        "clientMetadata" : {
                                "driver" : {
                                        "name" : "NetworkInterfaceASIO-RS",
                                        "version" : "3.4.9"
                                },
                                "os" : {
                                        "type" : "Linux",
                                        "name" : "CentOS Linux release 7.4.1708 (Core) ",
                                        "architecture" : "x86_64",
                                        "version" : "Kernel 3.10.0-693.el7.x86_64"
                                }
                        },
                        "active" : true,
                        "opid" : 757162244,
                        "secs_running" : 2,
                        "microsecs_running" : NumberLong(2386307),
                        "op" : "getmore",
                        "ns" : "local.oplog.rs",
                        "query" : {
                                "getMore" : NumberLong("12928643803"),
                                "collection" : "oplog.rs",
                                "maxTimeMS" : NumberLong(5000),
                                "term" : NumberLong(313),
                                "lastKnownCommittedOpTime" : {
                                        "ts" : Timestamp(1516859517, 1),
                                        "t" : NumberLong(313)
                                }
                        },
                        "originatingCommand" : {
                                "find" : "oplog.rs",
                                "filter" : {
                                        "ts" : {
                                                "$gte" : Timestamp(1516755142, 1)
                                        }
                                },
                                "tailable" : true,
                                "oplogReplay" : true,
                                "awaitData" : true,
                                "maxTimeMS" : NumberLong(60000),
                                "term" : NumberLong(313)
                        },
                        "planSummary" : "COLLSCAN",
                        "numYields" : 0,
                        "locks" : {

                        },
                        "waitingForLock" : false,
                        "lockStats" : {
                                "Global" : {
                                        "acquireCount" : {
                                                "r" : NumberLong(2)
                                        }
                                },
                                "Database" : {
                                        "acquireCount" : {
                                                "r" : NumberLong(1)
                                        }
                                },
                                "oplog" : {
                                        "acquireCount" : {
                                                "r" : NumberLong(1)
                                        }
                                }
                        }
                }
               
        ],
        "ok" : 1
}
"desc" : "conn111911",#数据库的连接信息,可与日志信息联系起来,可以用来筛选相关的日志信息
"threadId" : "140075999385344",#线程ID
"connectionId" : 111911,数据库的连接ID
"client" : "10.62.124.34:37476",#连接的客户端信息
"clientMetadata" : {
"driver" : {
"name" : "NetworkInterfaceASIO-RS",
"version" : "3.4.9"
},
"os" : {
"type" : "Linux",
"name" : "CentOS Linux release 7.4.1708 (Core) ",
"architecture" : "x86_64",
"version" : "Kernel 3.10.0-693.el7.x86_64"
}
},
"active" : true,#是否活动状态,true表示当前正在运行,false表示此操作已交出或在等待其他操作交出锁
"opid" : 757162244,#操作的唯一标识符,可通过它来终止操作
"secs_running" : 2,#查看执行时间,可以通过该参数定位耗时的操作
"microsecs_running" : NumberLong(2386307),
"op" : "getmore",#操作类型,包括(insert/query/update/remove/getmore/command)
"ns" : "local.oplog.rs",#命名空间
"query" : {#如果op是查询操作,这里将显示查询内容;也有说这里显示具体的操作语句的
"getMore" : NumberLong("12928643803"),
"collection" : "oplog.rs",
"maxTimeMS" : NumberLong(5000),
"term" : NumberLong(313),
"lastKnownCommittedOpTime" : {
"ts" : Timestamp(1516859517, 1),
"t" : NumberLong(313)
}
},
"originatingCommand" : {
"find" : "oplog.rs",
"filter" : {
"ts" : {
"$gte" : Timestamp(1516755142, 1)
}
},
"tailable" : true,
"oplogReplay" : true,
"awaitData" : true,
"maxTimeMS" : NumberLong(60000),
"term" : NumberLong(313)
},
"planSummary" : "COLLSCAN",
"numYields" : 0,#表示该操作交出锁,而使其他操作得以运行
"locks" : {


},
"waitingForLock" : false,#表示该操作是否因正在等待其他操作交出锁而处于阻塞状态
"lockStats" : {
"Global" : {
"acquireCount" : {
"r" : NumberLong(2)
}
},
"Database" : {
"acquireCount" : {
"r" : NumberLong(1)
}
},
"oplog" : {
"acquireCount" : {
"r" : NumberLong(1)
}
}
}

参考https://docs.mongodb.com/manual/reference/method/db.currentOp/index.html
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值