我看到examples人将EMR输出写入HDFS,但是我无法找到它是如何完成的示例。最重要的是,this documentation似乎表示EMR流作业的--output参数必须是一个S3存储桶。
当我实际尝试运行脚本时(在这种情况下,使用python streaming和mrJob),它会抛出“无效的S3 URI”错误。
这是命令:
python my_script.py -r emr \
--emr-job-flow-id=j-JOBID --conf-path=./mrjob.conf --no-output \
--output hdfs:///my-output \
hdfs:///my-input-directory/my-files*.gz
追溯......
Traceback (most recent call last):
File "pipes/sampler.py", line 28, in <module>
SamplerJob.run()
File "/Library/Python/2.7/site-packages/mrjob/job.py", line 483, in run
mr_job.execute()
File "/Library/Python/2.7/site-packages/mrjob/job.py", line 501, in execute
super(MRJob, self).execute()
File "/Library/Python/2.7/site-packages/mrjob/launch.py", line 146, in execute
self.run_job()
File "/Library/Python/2.7/site-packages/mrjob/launch.py", line 206, in run_job
with self.make_runner() as runner:
File "/Library/Python/2.7/site-packages/mrjob/job.py", line 524, in make_runner
return super(MRJob, self).make_runner()
File "/Library/Python/2.7/site-packages/mrjob/launch.py", line 161, in make_runner
return EMRJobRunner(**self.emr_job_runner_kwargs())
File "/Library/Python/2.7/site-packages/mrjob/emr.py", line 585, in __init__
self._output_dir = self._check_and_fix_s3_dir(self._output_dir)
File "/Library/Python/2.7/site-packages/mrjob/emr.py", line 776, in _check_and_fix_s3_dir
raise ValueError('Invalid S3 URI: %r' % s3_uri)
ValueError: Invalid S3 URI: 'hdfs:///input/sample'
如何将EMR流媒体作业的输出写入HDFS?它甚至可能吗?
答案 0 :(得分:1)
我不确定如何使用mrJob完成,但是使用hadoop和streaming jobs written in java,我们按如下方式执行:
使用EMR CLI,我们按以下方式执行:
> export jobflow=$(elastic-mapreduce --create --alive --plain-output
> --master-instance-type m1.small --slave-instance-type m1.xlarge --num-instances 21 --name "Custer Name" --bootstrap-action s3://elasticmapreduce/bootstrap-actions/configure-hadoop --args
> "--mapred-config-file,s3://myBucket/conf/custom-mapred-config-file.xml")
>
>
> elastic-mapreduce -j $jobflow --jar
> s3://us-east-1.elasticmapreduce/libs/s3distcp/1.latest/s3distcp.jar
> --arg --src --arg 's3://myBucket/input/' --arg --dest --arg 'hdfs:///input'
>
> elastic-mapreduce --jobflow $jobflow --jar s3://myBucket/bin/step1.jar
> --arg hdfs:///input --arg hdfs:///output-step1 --step-name "Step 1"
>
> elastic-mapreduce --jobflow $jobflow --jar s3://myBucket/bin/step2.jar
> --arg hdfs:///input,hdfs:///output-step1 --arg s3://myBucket/output/ --step-name "Step 2"
答案 1 :(得分:0)
它必须是S3存储桶,因为在完成作业后EMR群集不会正常保留。因此,保持输出的唯一方法是在群集之外,而下一个最接近的位置是S3。
答案 2 :(得分:0)
目前无法保存MRJob EMR作业的输出。目前在https://github.com/Yelp/mrjob/issues/887处有一个公开的freature请求。