2011-05-03 26 views
24

我寫了一個mapreduce作業來從數據集中提取一些信息。數據集是用戶對電影的評價。用戶數量約爲25萬,電影數量約爲30萬。地圖的輸出是<user, <movie, rating>*> and <movie,<user,rating>*>。在reducer中,我會處理這些對。如何解決「任務attempt_201104251139_0295_r_000006_0未能報告600秒的狀態。」

但是當我運行作業,映射器完成的預期,但減速總是抱怨說,

Task attempt_* failed to report status for 600 seconds. 

我知道這是由於未能及時更新的狀態,所以我在我的代碼添加調用context.progress()像這樣:

int count = 0; 
while (values.hasNext()) { 
    if (count++ % 100 == 0) { 
    context.progress(); 
    } 
    /*other code here*/ 
} 

不幸的是,這沒有幫助。還有很多減少任務失敗。

這裏是日誌:

Task attempt_201104251139_0295_r_000014_1 failed to report status for 600 seconds. Killing! 
11/05/03 10:09:09 INFO mapred.JobClient: Task Id : attempt_201104251139_0295_r_000012_1, Status : FAILED 
Task attempt_201104251139_0295_r_000012_1 failed to report status for 600 seconds. Killing! 
11/05/03 10:09:09 INFO mapred.JobClient: Task Id : attempt_201104251139_0295_r_000006_1, Status : FAILED 
Task attempt_201104251139_0295_r_000006_1 failed to report status for 600 seconds. Killing! 

BTW,錯誤發生在降低複製階段,日誌說:

reduce > copy (28 of 31 at 26.69 MB/s) > :Lost task tracker: tracker_hadoop-56:localhost/127.0.0.1:34385 

感謝您的幫助。

+0

你可以考慮發出context.progress()調用更多經常。只要context.progress()調用之間的時間不超過限制(您的配置中需要600秒),您的代碼應該工作。 – cabad 2013-07-18 22:09:40

回答

26

最簡單的方法將是設置此配置參數:

<property> 
    <name>mapred.task.timeout</name> 
    <value>1800000</value> <!-- 30 minutes --> 
</property> 

mapred-site.xml

+0

謝謝你的回答。我仍然不確定一件事。日誌中顯示「減少>複製」(丟失任務跟蹤器:tracker_hadoop-56:localhost/127.0.0.1:34385)「(28中的28爲26.69 MB/s)>。這是什麼意思? – user572138 2011-05-03 06:15:43

+0

哈哈,是的,這是固定的問題。這就是說,你的任務追蹤器已經消失/墜毀。這可能是各種問題。看看日誌。我假設你的文件描述符清空了。 – 2011-05-03 09:13:06

+1

這實際上不是一個修復。這是一個解決方法,如果任務被放大,將會遇到同樣的問題。 – 2016-02-18 17:44:32

15

最簡單的一種方法是在你的作業配置設置方案

Configuration conf=new Configuration(); 
long milliSeconds = 1000*60*60; <default is 600000, likewise can give any value) 
conf.setLong("mapred.task.timeout", milliSeconds); 

內* *在設置它之前,請檢查jobtracker GUI中的Job文件(job.xml)文件內部是否存在正確的屬性名稱mapred.task.timeout或mapreduce.task.tim eout 。 。 。 ,同時在作業文件中再次運行作業檢查,無論該屬性是否根據設置的值進行更改。

+0

這種方法可能會更好,因爲您可能希望您的常規作業在10分鐘後超時。根據需要配置特殊需求,而不是一般情況。 – 2013-10-14 20:25:09

3

如果有蜂巢查詢和它的定時時,可以設置在以下方式上述結構:

組mapred.tasktracker.expiry.interval = 1800000;

set mapred.task.timeout = 1800000;

11

在較新版本中,參數名稱已更改爲mapreduce.task.timeout,如link(搜索task.timeout)中所述。此外,您還可以在上面的鏈接描述禁用此超時:

如果 既不讀取輸入毫秒的任務前的數字將被終止,寫的輸出,也沒有更新其狀態 串。值爲0會禁用超時。

下面就是一個例子在mapred-site.xml設置:

<property> 
    <name>mapreduce.task.timeout</name> 
    <value>0</value> <!-- A value of 0 disables the timeout --> 
</property> 
1

https://issues.apache.org/jira/browse/HADOOP-1763

的原因可能是:

1. Tasktrackers run the maps successfully 
2. Map outputs are served by jetty servers on the TTs. 
3. All the reduce tasks connects to all the TT where maps are run. 
4. since there are lots of reduces wanting to connect the map output server, the jetty servers run out of threads (default 40) 
5. tasktrackers continue to make periodic heartbeats to JT, so that they are not dead, but their jetty servers are (temporarily) down.