Example of MapReduce Program
535 views
Oct 24, 2024
Example of MapReduce Program Watch more Videos at https://www.tutorialspoint.com/videotutorials/index.htm Lecture By: Mr. Arnab Chakraborty, Tutorials Point India Private Limited
View Video Transcript
0:00
In this video we are discussing example of MapReduce program
0:05
So, here we are going to take a very common program that is a what count problem, which
0:10
is the Hallow Old Program in our MapReduce. So, let us go through the steps
0:17
The practical demonstration of what count problem. To run a Map �ase program, we need to start the Hadoop Demons first
0:25
So, please initialize the Hadoop Demons so that it can, you can run this
0:29
this MapReduce program under it. Create a copy a file into the SDFS and put the file inside
0:38
a separate directory in this case we are considering slash input directory. So here we are having
0:44
one file on which this MapReduce program will be working. The MapReduce will create another
0:50
directory in this case it will be slash output. We have mentioned this one you can change it
0:56
And in that directory, there will be a part file and the file will hold the final MapReduce
1:02
program output. So, in the output directory, the file will be there, which is a part file containing
1:08
the output of the MapReduce program and in the input folder will be having our respective file on which the MapReduce program will be working on that And for that purpose you are supposed to use the put command to put the file from the
1:23
Unique system to the SDFS. The WordCound program is one of the default programs and that comes with Hadoop itself
1:32
And we can use the JAR file to execute the MapReduce task accordingly
1:39
The syntax of using the jar file to start the map produce task will be like this
1:44
So, Hadoop, JAR, JAR path, class name and the respective parameters. In this case, the parameters are the input and the output directories are to be mentioned
1:55
in this particular command. So let us go for one practical demonstration for the easy understanding of this concept
2:03
Whenever we install Hadoop, always you know that HADU comes with the default one map produce
2:08
program one on the what count so this what count program we are going to execute right now we
2:16
can show you that how this particular what count program can get executed it comes with the
2:21
had do by default automatically so in that case we opening one terminal here so control alter t is a terminal we having we going for eco dollar home to show you the corresponding value of this variable system variable that is a home
2:37
so there is a slash home slash big data so eco dollar hadup install so this particular variable
2:46
is having the value the path is slash home slash big data slash hadoop so remember this one so now
2:53
what we are trying to do is that we shall execute our wordcon program on a on a certain file so now
3:01
here i'm going to show you the file here see i'm just going to show you the file so i'm just
3:06
opening this one so i'm at the home home means in which path that is a slash home slash big data
3:12
so that is a home so under this home we are having a hadub my files and under this hard of my files
3:18
we're having this student underscore info c sb and also so sample underscore file dot txd so we shall execute our map produce what can program on this sample
3:31
underscore file dot txd okay so we'll be executing on it so let me see the content of it so we shall go
3:37
for eco we shall go for cat rather so cat we can go for that is our home we can write this home in this way putting a dollar in front we can go for home and then slash there is a haduk my files and the name of
3:58
the file is sample file dot tx t okay so that is a way we have seen the content of the
4:09
file you say the same comment can also be written in this way the same command
4:13
instead of writing this home we can also put tilt symbol here so that will also do
4:19
the same others we can write into details that is a slash home big data so that is
4:29
another way to get the same file content so this is a content on which my
4:34
what count map produce program will be working now let me tell you where this
4:39
particular map produce program is is residing here so in that case I shall come to home
4:45
then I shall come to Hadoop remember this path home Hadoop then I shall go for share
4:52
home Hadoop share Hadoop again map reduce so home Hadoop share Hadoop MapReduce
#Computer Science
#Programming
#Software