mongodb db.currentOp()信息
op = db.currentOp()
x = op['inprog'][0]
# 系统线程ID
x['threadId'] = "139797868844800"
# 服务地址
x['host'] = "centos:10004"
# 客户端名
x['desc'] = "conn21425554"
# 客户端ID
x['connectionId'] = 21425554
# 客户端地址
x['client'] = "127.0.0.1:24285"
# 客户端的连接配置信息,3.4支持
x['appName'] = "test"
# 客户端系统平台和驱动信息, 4.2支持
x['clientMetadata'] = { driver : { name : mongo-java-driver, version : 3.6.3 }, os : { type : Linux, name : Linux, architecture : amd64, version : 4.9.0-141-custom }, platform : Java/Oracle Corporation/1.8.0_201-b09 }
# 会话标识符, 仅当操作与会话关联时才存在。待研究
x['lsid'] = { id : UUID(2b0723cf-4a23-4e33-962c-642b9c3d52c3), uid : BinData(0,Wt3UaZNhxX9MYoloFhnakwd/L3uE3KXPZQOo2zwFnUQ=) }
# 操作ID
x['opid'] = 11
# 操作类型, 包括none update insert query command getmore remove killcursors
x['op'] = "command"
# 操作的表: <database>.<collection>
x['ns'] = "admin.$cmd"
# 已运行时间,秒
x['secs_running'] = 1964721
# 开始时间, 3.6支持
x['currentOpTime'] = "2021-02-25T11:00:36.548+0800"
# 已运行时间,毫秒
x['microsecs_running'] = NumberLong("40619427247619")
# 操作运行状态
x['active'] = true
# 操作暂停次数
x['numYields'] = 0
# 执行计划, 3.6支持
x['planSummary'] = "COLLSCAN"
# 操作命令, 当不为getmore类型时,可以由db.runCommand操作
x['query'] = {"currentOp" : 1}
# 操作命令,当不为getmore类型时,可以由db.runCommand操作, 3.6支持
x['command'] = {"currentOp" : 1}
# 操作命令,当command为getmore类型时存在,可以由db.runCommand操作, 3.6支持
x['originatingCommand'] = {
"find" : "oplog.rs",
"filter" : {
"ts" : {
"$gte" : Timestamp(1611542865, 1)
}
},
"tailable" : true,
"oplogReplay" : true,
"awaitData" : true,
"maxTimeMS" : NumberLong(60000),
"batchSize" : 13981010,
"term" : NumberLong(1),
"readConcern" : {
"afterClusterTime" : Timestamp(1611542865, 1)
},
"$replData" : 1,
"$oplogQueryData" : 1,
"$readPreference" : {
"mode" : "secondaryPreferred"
},
"$clusterTime" : {
"clusterTime" : Timestamp(1611542876, 103),
"signature" : {
"hash" : BinData(0,"GuFPLbLLmYWeCP3FTAk/cThXMvU="),
"keyId" : NumberLong("6911194195692617729")
}
},
"$db" : "local"
}
# 是否正在等待锁
x['waitingForLock'] = false
# 操作当前持有的锁定的类型和模式
x['locks'] = { "Global" : "r", "Database" : "r", "Collection" : "r" }
# 更详细的锁信息,acquireCount为获得锁的次数
x['lockStats'] = { Global : { acquireCount : { r : NumberLong(240) } }, Database : { acquireCount : { r : NumberLong(120) } }, Collection : { acquireCount : { r : NumberLong(120) } } }