i/o超时与mgo和mongodb。

时间:2021-12-15 13:00:59

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

我正在运行一个从mgo开始的mapreduce任务。它运行在一个超过350万条记录的集合上。由于某些原因,现在我不能将其移植到聚合中;可能以后。所以,mapreduce是我期待的东西。当我从我创建的原始js文件中运行它来测试代码和输出时,这个任务运行得很好。我试着把map和reduce代码放在两个字符串中,然后尝试调用mgo。MapReduce为我做MapReduce,在这里我在不同的集合中编写输出。它给了我

read tcp 127.0.0.1:27017: i/o timeout

读取tcp 127.0.0.1:27017: i/o超时。

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

然而,由于工作已经在后台被解雇,它仍在运行。现在根据这个线程——http://grokbase.com/t/gg/mgo- users/1396d96d9wyk3 /i-o-time -in-statistics- generationupsert。

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.

通过调用会话可以很容易地解决它。SetSocketTimeout但我不想这样做,因为这个map-reduce将运行的文档总数将会变化,因此,我认为,时间。因此,我将永远无法用这种方式来解决问题。

What are the other ways that I might have?

还有其他的方法吗?

Please help me

请帮我

1 个解决方案

#1


13  

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)

#1


13  

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)