hadoop hdfs文件系統文件以存在 解決辦法

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 existside

org.apache.hadoop.mapred.FileAlreadyExistsException: Output directory /output already existsoop

能夠看到致使錯誤的緣由時hdfs文件系統中的output文件夾已經存在了,因此必需要刪除。(由於outout文件夾是由hadoop自動生成的,因此會報錯)code


我使用的hadoop是 hadoop-1.1.0orm

查看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

相關文章
相關標籤/搜索