Professional Documents
Culture Documents
Develop & Execute Your First MapReduce Program PDF
Develop & Execute Your First MapReduce Program PDF
Develop & Execute Your First MapReduce Program PDF
1. Pre-requisite
The single-node Hadoop cluster should be ready. This means that all the
03
daemons should be running. Refer to the below screenshot for this:
www.acadgild.com 02
2. Step-by-Step Guide to Execute MapReduce Program
Follow the below mentioned steps to make a jar le and export it into
Hadoop environment.
Step 1
Step 2
www.acadgild.com 03
Step 3
Step 4
https://drive.google.com/le/d/0Bxr27gVaXO5s
RExfdndnaWN6WUk/view? usp=sharing
www.acadgild.com 04
After writing the code in Eclipse, you will encounter many errors as Eclipse does not
have the required Hadoop libraries.
Refer to the below screenshot where errors are highlighted with yellow colour:
Follow the steps mentioned below to remove errors during the compile time
by adding the two jars les in Hadoop directory.
Adding the two jar les will add the required references for the Hadoop
related classes and all the errors will get removed.
www.acadgild.com 05
Step 1
Step 2
Select libraries
-> Add External Jars.
Step 3
www.acadgild.com 06
Step 4
Step 5
Step 6
www.acadgild.com 07
Step 7
Click on ok to add
both the Jars.
Step 8
Once the errors are removed we need to export this jar le into the Linux File System.
www.acadgild.com 08
4. Making the Jar File and Exporting it to the Linux File System
The jar le created from the source code needs to be executed in Hadoop
environment as it cannot be executed in Eclipse in MapReduce mode.
Follow the below steps to create a jar le from the source code and then
export it to the Linux OS where Hadoop is installed.
Step 1
Step 2
www.acadgild.com 09
Step 3
Step 4
Click on Next.
www.acadgild.com 10
Step 5
Step 6
www.acadgild.com 11
Step 7
Step 7
The jar le has now been successfully exported to the specied location.
www.acadgild.com 12
5. Executing MapReduce Program
Step 1
www.acadgild.com 13
Step 2
The below le contains many words. We need to count the occurrence of all
these words.
Step 3
Copy the input le to HDFS using the Command hadoop dfs -put sample_input /.
Step 4
www.acadgild.com 14
Step 5
The MapReduce job execution starts after you enter the script.
Step 6
www.acadgild.com 15
Step 7
Type the command hadoop dfs -ls /sample_out to see the list of les present
in the output location specied in the Job execution.
Step 8
www.acadgild.com 16
Are You Looking For A Great Start To Your Career