Map Reducer

You might also like

Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 2

Mapper Reducer –Word Count Program

Steps:
1.Create Mapper,Reducer and Runner Files in local and move the same to hadoop path .

Local: cat /root/wordcount/ WordCount.java

hadoop fs –put /root/wordcount/ WordCount.java /user/root/wordcount/

hadoop fs –cat /user/root/wordcount/WordCount.java

2.Create input file in Local and move to HDFS

Cat /root/wordcount/ input_data/input.txt

Hadoop fs –put /root/wordcount/ input_data/input.txt /user/root/wordcount/input_data/

hadoop fs –ls /user/root/wordcount/input_data/input.txt

3.Create Output path in HDFS

hadoop fs –ls /user/root/wordcount/output/*

4.Create a Jar file or give the jar file that already present.

Cat /usr/hdp/2.2.0.0-2041/hadoop-mapreduce/hadoop-mapreduce-examples-2.6.0.2.2.0.0-2041.jar

cat /usr/hdp/2.2.0.0-2041/hadoop-mapreduce/hadoop-mapreduce-examples-2.6.0.2.2.0.0-2041.jar

wordcount/input/input_data.txt

hadoop-mapreduce-examples-2.6.0.2.2.0.0-2041.jar

hadoop-mapreduce-examples.jar

5.TO execute the mapper reducer

Hadoop jar jarpath programname inputpath outputpath


hadoop fs -put /root/wordcount/input1/ wordcount/

hadoop jar /usr/hdp/2.2.0.0-2041/hadoop-mapreduce/hadoop-mapreduce-examples-2.6.0.2.2.0.0-


2041.jar wordcount wordcount/input/input_data.txt wordcount/output/output_data.txt

6.To check output

hadoop fs -cat wordcount/output/*/part-r-00000

Once done remove the already present output path .

hadoop fs -rm wordcount/output/*/_SUCCESS

You might also like