Hadoop Online Tutorials

Run Example MapReduce Program

For testing YARN/Map Reduce Installation, we can run example mapreduce program (word count job) from the hadoop download directory. Hadoop release will contain map reduce examples in  share/hadoop/mapreduce/hadoop-mapreduce-examples-x.y.z.jar file.

In this demonstration, we will consider wordcount mapreduce program from the above jar to test the counts of each word in a input file and writes counts into output file.

1. Create input test file in local file system and copy it to HDFS. 

2. Run mapreduce program /job with below command.

Here the

3. If the job completes successfully and returning messages similar to above screens, verify the output of the map reduce job.

Output directory will contains

Job execution and outputs can also be verified through web interface. Please refer this post to know how to browse through HDFS & Job tracker using Web User Interface.

Note: 

If output directory already exists, map reduce job will fail with org.apache.hadoop.mapred.FileAlreadyExistsException. As shown in below screen.

In this case, delete the output file and re-execute the job.