0
votes

I was trying to run the basic WordCount example of Apache MapReduce 2.7 from here:

https://hadoop.apache.org/docs/r2.7.0/hadoop-mapreduce-client/hadoop-mapreduce-client-core/MapReduceTutorial.html#Example:_WordCount_v1.0

I put the input files at : /user/hadoopLearning/WordCount/input/ Output path : /user/hadoopLearning/WordCount/output/

then I ran the following command :

 hadoop jar wc.jar WordCount /user/hadoopLearning/WordCount/input/file01  /user/hadoopLearning/WordCount/output

However on running I am getting the following error:

Exception in thread "main" org.apache.hadoop.mapred.FileAlreadyExistsException: **Output directory** hdfs://sandbox.hortonworks.com:8020/user/hadoopLearning/WordCount/**input**/file01 already exists

I haven't written a single piece of code and copied everything from above location from Apache's website.

I understand the error , but the if we closely look at the error it says the output directory already exists and in the stack trace it gives the path of input directory.

Please can anyone help me. I am a beginner in the field of hadoop. Thanks in advance.

1

1 Answers

0
votes

You're trying to create a file which already exists.

HDFS doesn't allow that.

replace your output path ('/user/hadoopLearning/WordCount/output'), with something else.

try this command

       hadoop jar wc.jar WordCount /user/hadoopLearning/WordCount/input/file01  /user/hadoopLearning/WordCount/new_output_path