i/o超时问题与mgo和mongodb相关。

huangapple go评论82阅读模式
英文:

i/o timeout with mgo and mongodb

问题

我正在从mgo运行一个map-reduce作业。它在一个包含超过3.5M条记录的集合上运行。由于某些原因,我现在无法将其转换为聚合操作;也许以后可以。所以,我期待的是map-reduce。当我从我创建的原始js文件中运行这个作业来测试代码和输出时,它可以正常运行。我尝试将map和reduce代码放在两个字符串中,然后尝试调用mgo.MapReduce来执行map-reduce操作,将输出写入不同的集合。但是它给了我一个错误信息:

read tcp 127.0.0.1:27017: i/o timeout

尽管作业已在后台运行,但仍在运行。根据这个线程的解释,可以通过调用session.SetSocketTimeout来解决这个问题:http://grokbase.com/t/gg/mgo-users/1396d9wyk3/i-o-timeout-in-statistics-generation-upsert

但是我不想这样做,因为这个map-reduce将在不同数量的文档上运行,因此时间会有所变化。所以,我认为这种方式永远无法解决问题。

还有其他的解决方法吗?

请帮助我。

英文:

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

答案1

得分: 18

将我的评论转为答案。

我认为修复这个问题的唯一方法就是将套接字超时设置为非常高的值,例如:

session.SetSocketTimeout(1 * time.Hour)
英文:

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)

huangapple
  • 本文由 发表于 2014年7月9日 19:33:44
  • 转载请务必保留本文链接:https://go.coder-hub.com/24652587.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定