hadoop—在amazon emr上运行自定义jar,使用amazon s3 bucket输入和输出给出错误(文件系统错误)

35g0bw71  于 2021-06-03  发布在  Hadoop
关注(0)|答案(1)|浏览(269)

我尝试在amazonemr集群上运行一个自定义jar,使用自定义jar的输入和输出参数作为s3 bucket( -input s3n://s3_bucket_name/ldas/in -output s3n://s3_bucket_name/ldas/out )
当集群运行这个定制jar时,会发生以下异常。

Exception in thread "main" java.lang.IllegalArgumentException:**Wrong FS: s3n://s3_bucket_name/ldas/out, expected: hdfs://10.214.245.187:9000**
    at org.apache.hadoop.fs.FileSystem.checkPath(FileSystem.java:644)
    at org.apache.hadoop.hdfs.DistributedFileSystem.getPathName(DistributedFileSystem.java:181)
    at org.apache.hadoop.hdfs.DistributedFileSystem.access$000(DistributedFileSystem.java:92)
    at org.apache.hadoop.hdfs.DistributedFileSystem$11.doCall(DistributedFileSystem.java:585)
    at org.apache.hadoop.hdfs.DistributedFileSystem$11.doCall(DistributedFileSystem.java:581)
    at org.apache.hadoop.fs.FileSystemLinkResolver.resolve(FileSystemLinkResolver.java:81)
    at org.apache.hadoop.hdfs.DistributedFileSystem.delete(DistributedFileSystem.java:581)
    at cc.mrlda.ParseCorpus.run(ParseCorpus.java:101)
    at cc.mrlda.ParseCorpus.run(ParseCorpus.java:77)
    at org.apache.hadoop.util.ToolRunner.run(ToolRunner.java:70)
    at cc.mrlda.ParseCorpus.main(ParseCorpus.java:727)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:606)
    at org.apache.hadoop.util.RunJar.main(RunJar.java:212)

如何纠正这个错误?如何在amazon emr中使用s3n bucket作为文件系统?另外,我认为将默认文件系统更改为s3存储桶也不错,但我不知道如何做到这一点。

fcwjkofz

fcwjkofz1#

我建议您检查jar是否使用了与这里所示相同的处理参数的方法:http://java.dzone.com/articles/running-elastic-mapreduce-job
明确地,

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

或者,我已经成功地添加了自定义脚本运行程序步骤,将文件从s3复制到hadoop,反之亦然。特别是如果您连续有几个流式处理步骤,那么将内容保留在hdfs上是很有帮助的。您应该能够使用以下内容创建一个简单的bash脚本

hadoop fs -cp s3://s3_bucket_name/ldas/in hdfs:///ldas/in

hadoop fs -cp hdfs:///ldas/out s3://s3_bucket_name/ldas/out

然后将流化步骤设置为在hdfs:///ldas/in和hdfs:///ldas/out之间操作

相关问题