dongwu9170
2014-07-09 11:33
浏览 389

使用mgo和mongodb的I / O超时

I am running a map-reduce job from mgo. It runs on a collection with a little more than 3.5M records. For some reasons right now I can not port this to aggregation; may be later. So, map-reduce is the thing I am looking forward to. This job, when I run it from the original js files I have created to test the code and output, runs fine. I tried to put the map and reduce code inside two strings and then tried to call the mgo.MapReduce to do the map-reduce for me where I am writing the output in a different collection. And it gives me

read tcp 127.0.0.1:27017: i/o timeout

Though, as the job has been fired in back-ground it is still running. Now according to this thread here --- http://grokbase.com/t/gg/mgo-users/1396d9wyk3/i-o-timeout-in-statistics-generation-upsert

It is easy to solve by calling the session.SetSocketTimeout but I do not want to do this as the total number of documents on which this map-reduce will run will vary and thus, I believe, the time. So, I will never be able to solve the problem by that way I believe.

What are the other ways that I might have?

Please help me

图片转代码服务由CSDN问答提供 功能建议

我正在从mgo运行地图缩减作业。 它运行在具有超过350万条记录的集合上。 由于某些原因,我现在无法将此端口移植到聚合中。 可能会晚一些。 因此,map-reduce是我期待的事情。 当我从为测试代码和输出而创建的原始js文件运行该作业时,它运行良好。 我试图将地图和减少代码放在两个字符串中,然后尝试调用mgo.MapReduce为我做地图减少,以便在不同的集合中编写输出。 它使我

读取tcp 127.0.0.1:27017:I/O超时

不过,由于作业已在后台被解雇 它仍在运行。 现在根据这里的主题--- http://grokbase.com/t/gg/mgo-users/1396d9wyk3/io-timeout-in-statistics-generation-upsert

很容易解决 调用session.SetSocketTimeout,但我不想这样做,因为此map-reduce将在其上运行的文档总数会有所不同,因此,我相信,时间也会有所不同。 因此,我永远无法以这种方式解决问题。

我可能还有其他方法吗?

请帮助我

  • 点赞
  • 写回答
  • 关注问题
  • 收藏
  • 邀请回答

1条回答 默认 最新

  • dongyuelian9602 2014-07-09 12:06
    已采纳

    Moving my comment to an answer.

    I believe the only way to fix this is simply setting the socket timeout to something ridiculously high, for example:

    session.SetSocketTimeout(1 * time.Hour)
    
    点赞 评论

相关推荐 更多相似问题