我在mongoDB中有大量的记录(约300000) 我有一个在指定时间运行的bash脚本(crontab),它负责通过从第三方服务器收集来更新/插入记录。
我看到在插入/更新记录期间没有错误(因为我没有发现任何错误,使用带有grep的tail命令作为Exception)
这个脚本比平常花费更多时间,我的问题是,是否可以知道当前正在更新或插入哪个符号?
提前致谢。
我的db.currentOp()命令操作的结果。
Updated Part
db.currentOp()
{
"inprog" : [
{
"opid" : 2981398,
"active" : true,
"lockType" : "read",
"waitingForLock" : true,
"secs_running" : 1,
"op" : "query",
"ns" : "ubsc.symbols",
"query" : {
"unique_symbol" : "JBHTN221465.00"
},
"client" : "12.55.124.208:44958",
"desc" : "conn"
},
{
"opid" : 2981335,
"active" : true,
"lockType" : "read",
"waitingForLock" : true,
"secs_running" : 6,
"op" : "query",
"ns" : "ubsc.symbols",
"query" : {
"unique_symbol" : "MAING201330.00"
},
"client" : "12.55.124.208:44964",
"desc" : "conn"
},
{
"opid" : 2981364,
"active" : true,
"lockType" : "read",
"waitingForLock" : true,
"secs_running" : 4,
"op" : "query",
"ns" : "ubsc.symbols",
"query" : {
"symbol" : "WAG"
},
"client" : "12.55.124.208:44939",
"desc" : "conn"
},
{
"opid" : 2981390,
"active" : true,
"lockType" : "read",
"waitingForLock" : true,
"secs_running" : 3,
"op" : "query",
"ns" : "ubsc.symbols",
"query" : {
"unique_symbol" : "QDELX211330.00"
},
"client" : "12.55.124.208:44928",
"desc" : "conn"
},
{
"opid" : 2981425,
"active" : true,
"lockType" : "read",
"waitingForLock" : true,
"secs_running" : 0,
"op" : "query",
"ns" : "ubsc.symbols",
"query" : {
"unique_symbol" : "UAS201375.00"
},
"client" : "12.55.124.208:44940",
"desc" : "conn"
},
{
"opid" : 2981428,
"active" : true,
"lockType" : "read",
"waitingForLock" : true,
"secs_running" : 0,
"op" : "query",
"ns" : "ubsc.symbols",
"query" : {
"symbol" : "CAG"
},
"client" : "12.55.124.208:44943",
"desc" : "conn"
},
{
"opid" : 2981370,
"active" : true,
"lockType" : "read",
"waitingForLock" : true,
"secs_running" : 4,
"op" : "query",
"ns" : "ubsc.symbols",
"query" : {
"unique_symbol" : "GASXX211322.00"
},
"client" : "12.55.124.208:44929",
"desc" : "conn"
},
{
"opid" : 2981379,
"active" : true,
"lockType" : "read",
"waitingForLock" : true,
"secs_running" : 3,
"op" : "query",
"ns" : "ubsc.symbols",
"query" : {
"unique_symbol" : "SAFTS201350.00"
},
"client" : "12.55.124.208:44972",
"desc" : "conn"
},
{
"opid" : 2981421,
"active" : true,
"lockType" : "read",
"waitingForLock" : true,
"secs_running" : 0,
"op" : "query",
"ns" : "ubsc.symbols",
"query" : {
"symbol" : "YCS"
},
"client" : "12.55.124.208:44934",
"desc" : "conn"
},
{
"opid" : 2981424,
"active" : true,
"lockType" : "read",
"waitingForLock" : true,
"secs_running" : 0,
"op" : "query",
"ns" : "ubsc.symbols",
"query" : {
"symbol" : "DAR"
},
"client" : "12.55.124.208:44960",
"desc" : "conn"
},
{
"opid" : 2981377,
"active" : true,
"lockType" : "read",
"waitingForLock" : true,
"secs_running" : 3,
"op" : "query",
"ns" : "ubsc.symbols",
"query" : {
"unique_symbol" : "VARN221490.00"
},
"client" : "12.55.124.208:44968",
"desc" : "conn"
}
]
}
>
答案 0 :(得分:1)
db.currentOp()
(http://docs.mongodb.org/manual/reference/method/db.currentOp/)将告诉您有关mongod