際際滷

際際滷Share a Scribd company logo
MapReduce
http://www.allsoftsolutions.in
Job Class
 The Job class is the most important class in
the MapReduce API. It allows the user to
configure the job, submit it, control its
execution, and query the state. The set
methods only work until the job is submitted,
afterwards they will throw an
IllegalStateException.
http://www.allsoftsolutions.in
Mapper Class
 The Mapper class defines the Map job. Maps input key-
value pairs to a set of intermediate key-value pairs. Maps
are the individual tasks that transform the input records
into intermediate records. The transformed intermediate
records need not be of the same type as the input records.
A given input pair may map to zero or many output pairs.
 Method
 map is the most prominent method of the Mapper class.
The syntax is defined below 
 map(KEYIN key, VALUEIN value,
org.apache.hadoop.mapreduce.Mapper.Context context)
This method is called once for each key-value pair in the
input split.
http://www.allsoftsolutions.in
Reducer Class
 The Reducer class defines the Reduce job in MapReduce. It reduces
a set of intermediate values that share a key to a smaller set of
values. Reducer implementations can access the Configuration for a
job via the JobContext.getConfiguration() method. A Reducer has
three primary phases  Shuffle, Sort, and Reduce.
 Shuffle  The Reducer copies the sorted output from each Mapper
using HTTP across the network.
 Sort  The framework merge-sorts the Reducer inputs by keys
(since different Mappers may have output the same key). The
shuffle and sort phases occur simultaneously, i.e., while outputs are
being fetched, they are merged.
 Reduce  In this phase the reduce (Object, Iterable, Context)
method is called for each <key, (collection of values)> in the sorted
inputs.
http://www.allsoftsolutions.in
Reducer Method
 Method
 reduce is the most prominent method of the
Reducer class. The syntax is defined below 
 reduce(KEYIN key, Iterable<VALUEIN> values,
org.apache.hadoop.mapreduce.Reducer.Conte
xt context) This method is called once for each
key on the collection of key-value pairs.
http://www.allsoftsolutions.in
MapReduce Implementation
http://www.allsoftsolutions.in
Input Data
 hi how are you
 i am fine
 how are you
 what are you doining
 how is your job
 how is your family
http://www.allsoftsolutions.in
Steps
1. Create a Java Project :WordCount
2. Add External Jar files:
Rightclick on project Properties Java
BuildPath Add External jar Files 
Then:
click on FileSystem usr lib hadoop-0.20 
hadoop-core.jar ok ok
http://www.allsoftsolutions.in
Screenshot
http://www.allsoftsolutions.in
3. Create a class WordCount.java i.e your Driver
Code
4. Create a class Mapper i.e WordMapper.java
5. Create a class Reducer i.e WordReducer.java
http://www.allsoftsolutions.in
Import class
 import org.apache.hadoop.conf.Configured;
 import org.apache.hadoop.fs.Path;
 import org.apache.hadoop.io.IntWritable;
 import org.apache.hadoop.io.Text;
 Import org.apache.hadoop.mapred.FileInputFormat;
 import org.apache.hadoop.mapred.FileOutputFormat;
 import org.apache.hadoop.mapred.JobClient;
 import org.apache.hadoop.mapred.JobConf;
 import org.apache.hadoop.util.Tool;
 import org.apache.hadoop.util.ToolRunner;
http://www.allsoftsolutions.in
Class WordCount
http://www.allsoftsolutions.in
http://www.allsoftsolutions.in
Mapper class
http://www.allsoftsolutions.in
Reducer class
http://www.allsoftsolutions.in
Create jar file
 Right click on projct  export  java  jar
files  name of jar file  Finish
http://www.allsoftsolutions.in
http://www.allsoftsolutions.in
http://www.allsoftsolutions.in
Terminal Commands
http://www.allsoftsolutions.in
http://www.allsoftsolutions.in

http://www.allsoftsolutions.in
http://www.allsoftsolutions.in
http://www.allsoftsolutions.in
http://www.allsoftsolutions.in
http://localhost:50070

http://www.allsoftsolutions.in
Firefox Browser-Map Reduce
http://localhost:50050
http://www.allsoftsolutions.in
Ad

Recommended

Function
Function
Durgaprasad Yadav
Basic concept of js
Basic concept of js
ROHIT SHARMA
Javascript
Javascript
Tarek Raihan
Operator overloading (binary)
Operator overloading (binary)
Tirthika Bandi
Mysqlppt
Mysqlppt
poornima sugumaran
Navigation in React Native
Navigation in React Native
Sambhu Lakshmanan
Akka Streams
Akka Streams
Diego Pacheco
MySQL Training
MySQL Training
OpenSource Technologies Pvt. Ltd.
Introduction to the Map-Reduce framework.pdf
Introduction to the Map-Reduce framework.pdf
BikalAdhikari4
Lecture 2 part 3
Lecture 2 part 3
Jazan University
Map reduce prashant
Map reduce prashant
Prashant Gupta
Hadoop Programming - MapReduce, Input, Output, Serialization, Job
Hadoop Programming - MapReduce, Input, Output, Serialization, Job
Jason J Pulikkottil
Taxonomy of Scala
Taxonomy of Scala
shinolajla
Hadoop map reduce in operation
Hadoop map reduce in operation
Subhas Kumar Ghosh
Unit3 MapReduce
Unit3 MapReduce
Integral university, India
Types_of_Stats.pptxTypes_of_Stats.pptxTypes_of_Stats.pptx
Types_of_Stats.pptxTypes_of_Stats.pptxTypes_of_Stats.pptx
veyetas395
Hadoop Architecture
Hadoop Architecture
Dr. C.V. Suresh Babu
Join Algorithms in MapReduce
Join Algorithms in MapReduce
Shrihari Rathod
Pig Experience
Pig Experience
Tilani Gunawardena PhD(UNIBAS), BSc(Pera), FHEA(UK), CEng, MIESL
Session 19 - MapReduce
Session 19 - MapReduce
AnandMHadoop
Hadoop and HBase experiences in perf log project
Hadoop and HBase experiences in perf log project
Mao Geng
Big Data- process of map reducing MapReduce- .ppt
Big Data- process of map reducing MapReduce- .ppt
sunilsoni446112
Hadoop first mr job - inverted index construction
Hadoop first mr job - inverted index construction
Subhas Kumar Ghosh
Lecture 04 big data analytics | map reduce
Lecture 04 big data analytics | map reduce
anasbro009
Hive Anatomy
Hive Anatomy
nzhang
Hadoop eco system with mapreduce hive and pig
Hadoop eco system with mapreduce hive and pig
KhanKhaja1
MongoDB's New Aggregation framework
MongoDB's New Aggregation framework
Chris Westin
Big Data Analytics Chapter3-6@2021.pdf
Big Data Analytics Chapter3-6@2021.pdf
WasyihunSema2
C#.net
C#.net
AllsoftSolutions
Python tutorial
Python tutorial
AllsoftSolutions

More Related Content

Similar to Map reduce part1 (20)

Introduction to the Map-Reduce framework.pdf
Introduction to the Map-Reduce framework.pdf
BikalAdhikari4
Lecture 2 part 3
Lecture 2 part 3
Jazan University
Map reduce prashant
Map reduce prashant
Prashant Gupta
Hadoop Programming - MapReduce, Input, Output, Serialization, Job
Hadoop Programming - MapReduce, Input, Output, Serialization, Job
Jason J Pulikkottil
Taxonomy of Scala
Taxonomy of Scala
shinolajla
Hadoop map reduce in operation
Hadoop map reduce in operation
Subhas Kumar Ghosh
Unit3 MapReduce
Unit3 MapReduce
Integral university, India
Types_of_Stats.pptxTypes_of_Stats.pptxTypes_of_Stats.pptx
Types_of_Stats.pptxTypes_of_Stats.pptxTypes_of_Stats.pptx
veyetas395
Hadoop Architecture
Hadoop Architecture
Dr. C.V. Suresh Babu
Join Algorithms in MapReduce
Join Algorithms in MapReduce
Shrihari Rathod
Pig Experience
Pig Experience
Tilani Gunawardena PhD(UNIBAS), BSc(Pera), FHEA(UK), CEng, MIESL
Session 19 - MapReduce
Session 19 - MapReduce
AnandMHadoop
Hadoop and HBase experiences in perf log project
Hadoop and HBase experiences in perf log project
Mao Geng
Big Data- process of map reducing MapReduce- .ppt
Big Data- process of map reducing MapReduce- .ppt
sunilsoni446112
Hadoop first mr job - inverted index construction
Hadoop first mr job - inverted index construction
Subhas Kumar Ghosh
Lecture 04 big data analytics | map reduce
Lecture 04 big data analytics | map reduce
anasbro009
Hive Anatomy
Hive Anatomy
nzhang
Hadoop eco system with mapreduce hive and pig
Hadoop eco system with mapreduce hive and pig
KhanKhaja1
MongoDB's New Aggregation framework
MongoDB's New Aggregation framework
Chris Westin
Big Data Analytics Chapter3-6@2021.pdf
Big Data Analytics Chapter3-6@2021.pdf
WasyihunSema2
Introduction to the Map-Reduce framework.pdf
Introduction to the Map-Reduce framework.pdf
BikalAdhikari4
Map reduce prashant
Map reduce prashant
Prashant Gupta
Hadoop Programming - MapReduce, Input, Output, Serialization, Job
Hadoop Programming - MapReduce, Input, Output, Serialization, Job
Jason J Pulikkottil
Taxonomy of Scala
Taxonomy of Scala
shinolajla
Hadoop map reduce in operation
Hadoop map reduce in operation
Subhas Kumar Ghosh
Types_of_Stats.pptxTypes_of_Stats.pptxTypes_of_Stats.pptx
Types_of_Stats.pptxTypes_of_Stats.pptxTypes_of_Stats.pptx
veyetas395
Join Algorithms in MapReduce
Join Algorithms in MapReduce
Shrihari Rathod
Session 19 - MapReduce
Session 19 - MapReduce
AnandMHadoop
Hadoop and HBase experiences in perf log project
Hadoop and HBase experiences in perf log project
Mao Geng
Big Data- process of map reducing MapReduce- .ppt
Big Data- process of map reducing MapReduce- .ppt
sunilsoni446112
Hadoop first mr job - inverted index construction
Hadoop first mr job - inverted index construction
Subhas Kumar Ghosh
Lecture 04 big data analytics | map reduce
Lecture 04 big data analytics | map reduce
anasbro009
Hive Anatomy
Hive Anatomy
nzhang
Hadoop eco system with mapreduce hive and pig
Hadoop eco system with mapreduce hive and pig
KhanKhaja1
MongoDB's New Aggregation framework
MongoDB's New Aggregation framework
Chris Westin
Big Data Analytics Chapter3-6@2021.pdf
Big Data Analytics Chapter3-6@2021.pdf
WasyihunSema2

More from AllsoftSolutions (9)

C#.net
C#.net
AllsoftSolutions
Python tutorial
Python tutorial
AllsoftSolutions
Iot basics
Iot basics
AllsoftSolutions
C++ basics
C++ basics
AllsoftSolutions
Python1
Python1
AllsoftSolutions
R Basics
R Basics
AllsoftSolutions
Mysql using php
Mysql using php
AllsoftSolutions
Hbase
Hbase
AllsoftSolutions
Bigdata overview
Bigdata overview
AllsoftSolutions
Ad

Recently uploaded (20)

Pests of Maize: An comprehensive overview.pptx
Pests of Maize: An comprehensive overview.pptx
Arshad Shaikh
How to Manage Inventory Movement in Odoo 18 POS
How to Manage Inventory Movement in Odoo 18 POS
Celine George
ECONOMICS, DISASTER MANAGEMENT, ROAD SAFETY - STUDY MATERIAL [10TH]
ECONOMICS, DISASTER MANAGEMENT, ROAD SAFETY - STUDY MATERIAL [10TH]
SHERAZ AHMAD LONE
Paper 107 | From Watchdog to Lapdog: Ishiguros Fiction and the Rise of Godi...
Paper 107 | From Watchdog to Lapdog: Ishiguros Fiction and the Rise of Godi...
Rajdeep Bavaliya
Introduction to Generative AI and Copilot.pdf
Introduction to Generative AI and Copilot.pdf
TechSoup
Paper 109 | Archetypal Journeys in Interstellar: Exploring Universal Themes...
Paper 109 | Archetypal Journeys in Interstellar: Exploring Universal Themes...
Rajdeep Bavaliya
Chalukyas of Gujrat, Solanki Dynasty NEP.pptx
Chalukyas of Gujrat, Solanki Dynasty NEP.pptx
Dr. Ravi Shankar Arya Mahila P. G. College, Banaras Hindu University, Varanasi, India.
Paper 108 | Thoreaus Influence on Gandhi: The Evolution of Civil Disobedience
Paper 108 | Thoreaus Influence on Gandhi: The Evolution of Civil Disobedience
Rajdeep Bavaliya
Plate Tectonic Boundaries and Continental Drift Theory
Plate Tectonic Boundaries and Continental Drift Theory
Marie
SCHIZOPHRENIA OTHER PSYCHOTIC DISORDER LIKE Persistent delusion/Capgras syndr...
SCHIZOPHRENIA OTHER PSYCHOTIC DISORDER LIKE Persistent delusion/Capgras syndr...
parmarjuli1412
How to Implement Least Package Removal Strategy in Odoo 18 Inventory
How to Implement Least Package Removal Strategy in Odoo 18 Inventory
Celine George
Ray Dalio How Countries go Broke the Big Cycle
Ray Dalio How Countries go Broke the Big Cycle
Dadang Solihin
GEOGRAPHY-Study Material [ Class 10th] .pdf
GEOGRAPHY-Study Material [ Class 10th] .pdf
SHERAZ AHMAD LONE
SPENT QUIZ NQL JR FEST 5.0 BY SOURAV.pptx
SPENT QUIZ NQL JR FEST 5.0 BY SOURAV.pptx
Sourav Kr Podder
Introduction to problem solving Techniques
Introduction to problem solving Techniques
merlinjohnsy
Sustainable Innovation with Immersive Learning
Sustainable Innovation with Immersive Learning
Leonel Morgado
The Man In The Back Exceptional Delaware.pdf
The Man In The Back Exceptional Delaware.pdf
dennisongomezk
PEST OF WHEAT SORGHUM BAJRA and MINOR MILLETS.pptx
PEST OF WHEAT SORGHUM BAJRA and MINOR MILLETS.pptx
Arshad Shaikh
ENGLISH_Q1_W1 PowerPoint grade 3 quarter 1 week 1
ENGLISH_Q1_W1 PowerPoint grade 3 quarter 1 week 1
jutaydeonne
Pests of Maize: An comprehensive overview.pptx
Pests of Maize: An comprehensive overview.pptx
Arshad Shaikh
How to Manage Inventory Movement in Odoo 18 POS
How to Manage Inventory Movement in Odoo 18 POS
Celine George
ECONOMICS, DISASTER MANAGEMENT, ROAD SAFETY - STUDY MATERIAL [10TH]
ECONOMICS, DISASTER MANAGEMENT, ROAD SAFETY - STUDY MATERIAL [10TH]
SHERAZ AHMAD LONE
Paper 107 | From Watchdog to Lapdog: Ishiguros Fiction and the Rise of Godi...
Paper 107 | From Watchdog to Lapdog: Ishiguros Fiction and the Rise of Godi...
Rajdeep Bavaliya
Introduction to Generative AI and Copilot.pdf
Introduction to Generative AI and Copilot.pdf
TechSoup
Paper 109 | Archetypal Journeys in Interstellar: Exploring Universal Themes...
Paper 109 | Archetypal Journeys in Interstellar: Exploring Universal Themes...
Rajdeep Bavaliya
Paper 108 | Thoreaus Influence on Gandhi: The Evolution of Civil Disobedience
Paper 108 | Thoreaus Influence on Gandhi: The Evolution of Civil Disobedience
Rajdeep Bavaliya
Plate Tectonic Boundaries and Continental Drift Theory
Plate Tectonic Boundaries and Continental Drift Theory
Marie
SCHIZOPHRENIA OTHER PSYCHOTIC DISORDER LIKE Persistent delusion/Capgras syndr...
SCHIZOPHRENIA OTHER PSYCHOTIC DISORDER LIKE Persistent delusion/Capgras syndr...
parmarjuli1412
How to Implement Least Package Removal Strategy in Odoo 18 Inventory
How to Implement Least Package Removal Strategy in Odoo 18 Inventory
Celine George
Ray Dalio How Countries go Broke the Big Cycle
Ray Dalio How Countries go Broke the Big Cycle
Dadang Solihin
GEOGRAPHY-Study Material [ Class 10th] .pdf
GEOGRAPHY-Study Material [ Class 10th] .pdf
SHERAZ AHMAD LONE
SPENT QUIZ NQL JR FEST 5.0 BY SOURAV.pptx
SPENT QUIZ NQL JR FEST 5.0 BY SOURAV.pptx
Sourav Kr Podder
Introduction to problem solving Techniques
Introduction to problem solving Techniques
merlinjohnsy
Sustainable Innovation with Immersive Learning
Sustainable Innovation with Immersive Learning
Leonel Morgado
The Man In The Back Exceptional Delaware.pdf
The Man In The Back Exceptional Delaware.pdf
dennisongomezk
PEST OF WHEAT SORGHUM BAJRA and MINOR MILLETS.pptx
PEST OF WHEAT SORGHUM BAJRA and MINOR MILLETS.pptx
Arshad Shaikh
ENGLISH_Q1_W1 PowerPoint grade 3 quarter 1 week 1
ENGLISH_Q1_W1 PowerPoint grade 3 quarter 1 week 1
jutaydeonne
Ad

Map reduce part1