hadoop遇到Output directory hdfs://iflytek01:9000/test/output already exists

hadoop遇到Output directory hdfs://iflytek01:9000/test/output already exists的解决方案

问题描述:

[root@iflytek01 ~]# hadoop jar /datas/wordcount02.jar TestReduce.WordCount /test/hdfs02.txt /test/output/
19/10/30 13:57:52 INFO client.RMProxy: Connecting to ResourceManager at iflytek01/192.168.230.125:8032
Exception in thread "main" org.apache.hadoop.mapred.FileAlreadyExistsException: Output directory hdfs://iflytek01:9000/test/output already exists
	at org.apache.hadoop.mapreduce.lib.output.FileOutputFormat.checkOutputSpecs(FileOutputFormat.java:146)
	at org.apache.hadoop.mapreduce.JobSubmitter.checkSpecs(JobSubmitter.java:268)
	at org.apache.hadoop.mapreduce.JobSubmitter.submitJobInternal(JobSubmitter.java:141)
	at org.apache.hadoop.mapreduce.Job$11.run(Job.java:1341)
	at org.apache.hadoop.mapreduce.Job$11.run(Job.java:1338)
	at java.security.AccessController.doPrivileged(Native Method)
	at javax.security.auth.Subject.doAs(Subject.java:422)
	at org.apache.hadoop.security.UserGroupInformation.doAs(UserGroupInformation.java:1840)
	at org.apache.hadoop.mapreduce.Job.submit(Job.java:1338)
	at org.apache.hadoop.mapreduce.Job.waitForCompletion(Job.java:1359)
	at TestReduce.WordCount.main(WordCount.java:44)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:498)
	at org.apache.hadoop.util.RunJar.run(RunJar.java:234)
	at org.apache.hadoop.util.RunJar.main(RunJar.java:148)



hadoop遇到Output directory hdfs://iflytek01:9000/test/output already exists_第1张图片

问题分析:执行该语句时

hadoop jar /datas/wordcount02.jar TestReduce.WordCount /test/hdfs02.txt /test/output/

应该在output不存在时才能执行,若存在,则会报这种错误。

解决方案:

删除output文件夹即可:

hadoop fs -rm -r /test/output/

在这里插入图片描述

你可能感兴趣的:(hadoop,HDFS,mapreduce)