Is it possible to get map reduce progress notifications in mongo?

狂风中的少年 提交于 2019-12-10 21:10:56

问题


Map Reduce is slow in Mongo. That is a given. So, I am wondering if it is possible to receive map reduce progress notifications.

Thanks.


回答1:


I don't know about any built-in features. You could, however, in a separate script run db.currentOp() every once in a while, read map-reduce progress and notify concerned parties.

This is an example of what I can see:

> db.currentOp()
{
    "inprog" : [
        {
            "opid" : 249198781,
            "active" : true,
            "lockType" : "read",
            "waitingForLock" : false,
            "secs_running" : 14,
            "op" : "query",
            "ns" : "mydb.mycoll",
            "query" : {
                "mapreduce" : "mycoll",
                "map" : function cf__9__f_() {
    emit(this.aid, 1);
},
                "reduce" : function cf__10__f_(k, vals) {
    var result = 0;
    vals.forEach(function (v) {result += v;});
    return result;
},
                "out" : {
                    "inline" : 1
                }
            },
            "client" : "127.0.0.1:44254",
            "desc" : "conn",
            "threadId" : "0x7e98f24e4700",
            "connectionId" : 1958947,
            "msg" : "m/r: (1/3) emit phase 644165/7670157 8%",
            "progress" : {
                "done" : 644165,
                "total" : 7670157
            },
            "numYields" : 644
        }
    ]
}


来源:https://stackoverflow.com/questions/11956942/is-it-possible-to-get-map-reduce-progress-notifications-in-mongo

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!