0

我在 mongoDB 中有大量记录(大约 300000)我有一个在指定时间运行的 bash 脚本(crontab),它负责通过从第三方服务器收集来更新/插入记录。

我看到在插入/更新记录期间没有错误(因为我没有发现任何错误,通过使用带有 grep 作为异常的 tail 命令)

这个脚本比平时花费更多的时间,我的问题是是否有可能知道当前正在更新或插入哪个符号?

提前致谢 。

我的 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"
                }

        ]
}
>
4

1 回答 1

0

db.currentOp()( http://docs.mongodb.org/manual/reference/method/db.currentOp/ ) 将告诉您正在进行的操作mongod

于 2013-07-16T10:01:59.530 回答