带有Hadoop的MapReduce,“ Ouput文件目录已存在”

时间:2018-12-05 13:05:32

标签: java amazon-web-services hadoop mapreduce

我正在尝试使用Amazon EMR服务上托管的集群。我正在尝试使用WordCount.jar文件和带有随机输出文件夹的input1.txt运行WordCount示例。我输入的语法是WordCount argv [1] argv [2]。 input1.txt的路径为argv [1],而argv [2]为输出路径。我知道,如果您多次尝试使用同一输出目录,那么hadoop会发疯。只是为了绝对确保你们,我知道了->

FileInputFormat.addInputPath(job, new Path(args[1]));
FileOutputFormat.setOutputPath(job, new Path(args[2]));

但是无论我放入哪个输出目录,都是我的结果,

Exception in thread "main" org.apache.hadoop.mapred.FileAlreadyExistsException: Output directory https://s3.us-east-2.amazonaws.com/mydirectory/gabagooba already exists
at org.apache.hadoop.mapreduce.lib.output.FileOutputFormat.checkOutputSpecs(FileOutputFormat.java:146)
at org.apache.hadoop.mapreduce.JobSubmitter.checkSpecs(JobSubmitter.java:268)
at org.apache.hadoop.mapreduce.JobSubmitter.submitJobInternal(JobSubmitter.java:141)
at org.apache.hadoop.mapreduce.Job$11.run(Job.java:1341)
at org.apache.hadoop.mapreduce.Job$11.run(Job.java:1338)
at java.security.AccessController.doPrivileged(Native Method)
at javax.security.auth.Subject.doAs(Subject.java:422)
at org.apache.hadoop.security.UserGroupInformation.doAs(UserGroupInformation.java:1844)
at org.apache.hadoop.mapreduce.Job.submit(Job.java:1338)
at org.apache.hadoop.mapreduce.Job.waitForCompletion(Job.java:1359)
at WordCountDemo.WordCount.main(WordCount.java:62)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.apache.hadoop.util.RunJar.run(RunJar.java:239)
at org.apache.hadoop.util.RunJar.main(RunJar.java:153)

我的输出目录应该存储在S3存储器中,但是当我去那里时,没有输出。任何帮助都会使我摆脱困境。

1 个答案:

答案 0 :(得分:0)

可以将输出位置指定为s3 而不是https。

示例:s3:// yourbucket / output

参考:https://docs.aws.amazon.com/emr/latest/ManagementGuide/emr-plan-output.html