我正在使用hadoop2.2.0。hadoop-mapreduce-examples-2.2.0.jar在hdfs上运行良好。
我在eclipse中制作了一个wordcount程序,并使用maven添加jar,然后运行这个jar:
ubuntu@ubuntu-linux:~$ yarn jar Sample-0.0.1-SNAPSHOT.jar com.vij.Sample.WordCount /user/ubuntu/wordcount/input/vij.txt user/ubuntu/wordcount/output
它给出以下错误: 15/02/17 13:09:09 WARN util.NativeCodeLoader: Unable to load native-hadoop library for your platform... using builtin-java classes where applicable 15/02/17 13:09:10 INFO client.RMProxy: Connecting to ResourceManager at /0.0.0.0:8032 15/02/17 13:09:11 ERROR security.UserGroupInformation: PriviledgedActionException as:ubuntu (auth:SIMPLE) cause:org.apache.hadoop.mapred.FileAlreadyExistsException: Output directory hdfs://localhost:54310/user/ubuntu/wordcount/input/vij.txt already exists Exception in thread "main" org.apache.hadoop.mapred.FileAlreadyExistsException: Output directory hdfs://localhost:54310/user/ubuntu/wordcount/input/vij.txt already exists at org.apache.hadoop.mapreduce.lib.output.FileOutputFormat.checkOutputSpecs(FileOutputFormat.java:146) at org.apache.hadoop.mapreduce.JobSubmitter.checkSpecs(JobSubmitter.java:456) at org.apache.hadoop.mapreduce.JobSubmitter.submitJobInternal(JobSubmitter.java:342) at org.apache.hadoop.mapreduce.Job$10.run(Job.java:1268) at org.apache.hadoop.mapreduce.Job$10.run(Job.java:1265) at java.security.AccessController.doPrivileged(Native Method) at javax.security.auth.Subject.doAs(Subject.java:415) at org.apache.hadoop.security.UserGroupInformation.doAs(UserGroupInformation.java:1491) at org.apache.hadoop.mapreduce.Job.submit(Job.java:1265) at com.vij.Sample.WordCount.main(WordCount.java:33) 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)
jar在我的本地系统上。输入和输出路径都在hdfs上。hdfs上的输出路径上不存在输出目录。
请给我建议。谢谢。
1条答案
按热度按时间yizd12fk1#
实际上,错误是:
删除已存在的输出文件“
vij.txt
,或输出到其他文件。或者尝试执行以下步骤:
从下面的链接下载并解压wordcount源代码
$HADOOP_HOME
.然后,将输入文件(任何文本格式文件)上载到hadoop分布式文件系统(hdfs)中:
在这里,
$HADOOP_HOME/Hadoop-WordCount/input/
是存储程序输入的本地目录。第二个“input”表示hdfs上的远程目标目录。将输入上传到hdfs后,使用以下命令运行wordcount程序。我们假设您已经编译了字数计算程序。
如果hadoop运行正常,它将打印hadoop运行消息,如下所示: