[英]Running Custom JAR on Amazon EMR giving error ( Filesystem Error ) using Amazon S3 Bucket input and output
我正在尝试使用自定义JAR的输入和输出参数作为S3存储桶在Amazon EMR集群上运行自定义JAR( -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存储桶用作文件系统? 另外,我认为将默认文件系统更改为s3存储桶会很好,但是我不确定如何做到这一点。
我建议您检查一下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之间进行操作
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.