hadoop 伪分布式环境时运行wordcount程序,已经运行过一次,在次将input文件夹中的内容上传hafs文件系统时会出现重复,可是仍是能够上传成功。java
可是当再次运行wordcount程序时就会报如下的错误apache
hadoop@salve:~/programfile/hadoop$ bin/hadoop jar hadoop-examples-*.jar wordcount /input /output 14/05/16 08:50:00 INFO mapred.JobClient: Cleaning up the staging area hdfs://localhost:9000/tmp/hadoop-hadoop/mapred/staging/hadoop/.staging/job_201405160835_0004 14/05/16 08:50:00 ERROR security.UserGroupInformation: PriviledgedActionException as:hadoop cause:org.apache.hadoop.mapred.FileAlreadyExistsException: Output directory /output already exists org.apache.hadoop.mapred.FileAlreadyExistsException: Output directory /output already exists at org.apache.hadoop.mapreduce.lib.output.FileOutputFormat.checkOutputSpecs(FileOutputFormat.java:137) at org.apache.hadoop.mapred.JobClient$2.run(JobClient.java:949) at org.apache.hadoop.mapred.JobClient$2.run(JobClient.java:912) 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:1136) at org.apache.hadoop.mapred.JobClient.submitJobInternal(JobClient.java:912) at org.apache.hadoop.mapreduce.Job.submit(Job.java:500) at org.apache.hadoop.mapreduce.Job.waitForCompletion(Job.java:530) at org.apache.hadoop.examples.WordCount.main(WordCount.java:67) 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.ProgramDriver$ProgramDescription.invoke(ProgramDriver.java:68) at org.apache.hadoop.util.ProgramDriver.driver(ProgramDriver.java:139) at org.apache.hadoop.examples.ExampleDriver.main(ExampleDriver.java:64) 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:156)
从这行错误提示中
分布式
hadoop cause:org.apache.hadoop.mapred.FileAlreadyExistsException: Output directory /output already exists
ide
org.apache.hadoop.mapred.FileAlreadyExistsException: Output directory /output already exists
oop
能够看到致使错误的缘由时hdfs文件系统中的output文件夹已经存在了,因此必需要删除。(由于outout文件夹是由hadoop自动生成的,因此会报错)
code
我使用的hadoop是 hadoop-1.1.0
orm
查看hdfs文件系统的命令为
ip
hadoop@salve:~/programfile/hadoop$ bin/hadoop fs -ls /
删除output文件夹和tmp文件夹hadoop
hadoop@salve:~/programfile/hadoop$ bin/hadoop fs -rmr /output hadoop@salve:~/programfile/hadoop$ bin/hadoop fs -rmr /tmp
这样再试一下就能够了input