# 失败的映射任务数超出允许的限制



我正在尝试使用Python进行Hadoop流。我从这里获得帮助编写了简单的地图和减少脚本

map脚本如下:

#!/usr/bin/env python
import sys, urllib, re
title_re = re.compile("<title>(.*?)</title>", re.MULTILINE | re.DOTALL | re.IGNORECASE)
for line in sys.stdin:
    url = line.strip()
    match = title_re.search(urllib.urlopen(url).read())
    if match :
        print url, "t", match.group(1).strip()

reduce脚本如下:

#!/usr/bin/env python
from operator import itemgetter
import sys
for line in sys.stdin :
    line = line.strip()
    print line

使用 hadoop 流 jar 运行这些脚本后,map任务完成,我可以看到它们已完成 100%,但reduce工作卡在 22%,并且在很长一段时间后它给出了ERROR streaming.StreamJob: Job not successful. Error: # of failed Map Tasks exceeded allowed limit. FailedCount: 1.错误。

我无法找到这背后的确切原因。

我的终端窗口如下所示:

shekhar@ubuntu:/host/Shekhar/Softwares/hadoop-1.0.0$ hadoop jar contrib/streaming/hadoop-streaming-1.0.0.jar -mapper /host/Shekhar/HadoopWorld/MultiFetch.py -reducer /host/Shekhar/HadoopWorld/reducer.py -input /host/Shekhar/HadoopWorld/urls/* -output /host/Shekhar/HadoopWorld/titles3
Warning: $HADOOP_HOME is deprecated.
packageJobJar: [/tmp/hadoop-shekhar/hadoop-unjar2709939812732871143/] [] /tmp/streamjob1176812134999992997.jar tmpDir=null
12/05/27 11:27:46 INFO util.NativeCodeLoader: Loaded the native-hadoop library
12/05/27 11:27:46 INFO mapred.FileInputFormat: Total input paths to process : 3
12/05/27 11:27:46 INFO streaming.StreamJob: getLocalDirs(): [/tmp/hadoop-shekhar/mapred/local]
12/05/27 11:27:46 INFO streaming.StreamJob: Running job: job_201205271050_0006
12/05/27 11:27:46 INFO streaming.StreamJob: To kill this job, run:
12/05/27 11:27:46 INFO streaming.StreamJob: /host/Shekhar/Softwares/hadoop-1.0.0/libexec/../bin/hadoop job  -Dmapred.job.tracker=localhost:9001 -kill job_201205271050_0006
12/05/27 11:27:46 INFO streaming.StreamJob: Tracking URL: http://localhost:50030/jobdetails.jsp?jobid=job_201205271050_0006
12/05/27 11:27:47 INFO streaming.StreamJob:  map 0%  reduce 0%
12/05/27 11:28:07 INFO streaming.StreamJob:  map 67%  reduce 0%
12/05/27 11:28:37 INFO streaming.StreamJob:  map 100%  reduce 0%
12/05/27 11:28:40 INFO streaming.StreamJob:  map 100%  reduce 11%
12/05/27 11:28:49 INFO streaming.StreamJob:  map 100%  reduce 22%
12/05/27 11:31:35 INFO streaming.StreamJob:  map 67%  reduce 22%
12/05/27 11:31:44 INFO streaming.StreamJob:  map 100%  reduce 22%
12/05/27 11:34:52 INFO streaming.StreamJob:  map 67%  reduce 22%
12/05/27 11:35:01 INFO streaming.StreamJob:  map 100%  reduce 22%
12/05/27 11:38:11 INFO streaming.StreamJob:  map 67%  reduce 22%
12/05/27 11:38:20 INFO streaming.StreamJob:  map 100%  reduce 22%
12/05/27 11:41:29 INFO streaming.StreamJob:  map 67%  reduce 22%
12/05/27 11:41:35 INFO streaming.StreamJob:  map 100%  reduce 100%
12/05/27 11:41:35 INFO streaming.StreamJob: To kill this job, run:
12/05/27 11:41:35 INFO streaming.StreamJob: /host/Shekhar/Softwares/hadoop-1.0.0/libexec/../bin/hadoop job  -Dmapred.job.tracker=localhost:9001 -kill job_201205271050_0006
12/05/27 11:41:35 INFO streaming.StreamJob: Tracking URL: http://localhost:50030/jobdetails.jsp?jobid=job_201205271050_0006
12/05/27 11:41:35 ERROR streaming.StreamJob: Job not successful. Error: # of failed Map Tasks exceeded allowed limit. FailedCount: 1. LastFailedTask: task_201205271050_0006_m_000001
12/05/27 11:41:35 INFO streaming.StreamJob: killJob...
Streaming Job Failed!

谁能帮我??

编辑工作跟踪器详情如下:

Hadoop job_201205271050_0006 on localhost
User: shekhar
Job Name: streamjob1176812134999992997.jar
Job File: file:/tmp/hadoop-shekhar/mapred/staging/shekhar/.staging/job_201205271050_0006/job.xml
Submit Host: ubuntu
Submit Host Address: 127.0.1.1
Job-ACLs: All users are allowed
Job Setup: Successful
Status: Failed
Failure Info:# of failed Map Tasks exceeded allowed limit. FailedCount: 1. LastFailedTask: task_201205271050_0006_m_000001
Started at: Sun May 27 11:27:46 IST 2012
Failed at: Sun May 27 11:41:35 IST 2012
Failed in: 13mins, 48sec
Job Cleanup: Successful
Black-listed TaskTrackers: 1
Kind    % Complete  Num Tasks   Pending Running Complete    Killed  Failed/Killed
Task Attempts
map 100.00%
3   0   0   2   1   4 / 0
reduce  100.00%
1   0   0   0   1   0 / 1

此错误只是一个一般错误,太多的 Map 任务无法完成:

失败的地图任务数超出允许的限制

您可以使用 EMR 控制台导航到各个 Map/Reduce 任务的日志。然后,您应该能够看到问题所在。

就我而言 - 当我犯了一些小错误时,例如错误地设置了地图脚本的路径,我遇到了此错误。

查看任务日志的步骤:

http://antipatterns.blogspot.nl/2013/03/amazon-emr-map-reduce-error-of-failed.html

我刚刚出现了同样的错误。就我而言,结果证明这是一个解析错误。在stdin拆分线路的地方有一条"意想不到"的新线。我建议检查您的数据文件。一旦我删除了具有这些新行的列,它就可以正常工作。

首先检查你的标准。您的信息不足以确定它是什么错误,stderr通常位于:{your hadoop temp dir here}/mapred/local/userlogs/{your job id}/{your attemp id}/stderr

肖恩的回答是当你第一次使用hadoop时,大多数情况下,所以我想你可能会得到一个'env:python\r:没有这样的文件或目录'错误。如果是这样,只需将您的 CR 更换为 LF 即可解决此问题。只需运行脚本将 \r 替换为

在映射器和化简器的开头添加以下行:

#!/usr/bin/python

相关内容

  • 没有找到相关文章

最新更新