Apache Hadoop Combiner java example
Hadoop is an Apache open source framework written in java that allows distributed processing of large datasets across clusters of computers using simple programming models.
The Hadoop framework application works in an environment that provides distributed storage and computation across clusters of computers. Hadoop is designed to scale up from single server to thousands of machines, each offering local computation and storage.
1) A machine with Ubuntu 14.04 LTS operating system installed.
2) Apache Hadoop 2.6.4 pre installed (How to install Hadoop on Ubuntu 14.04)
Hadoop Combiner Example
The Combiner class is used in between the Map class and the Reduce class to reduce the volume of data transfer between Map and Reduce. Usually, the output of the map task is large and the data transferred to the reduce task is high.
A Combiner, also known as a semi-reducer, is an optional class that operates by accepting the inputs from the Map class and thereafter passing the output key-value pairs to the Reducer class. The main function of a Combiner is to summarize the map output records with the same key. The output (key-value collection) of the combiner will be sent over the network to the actual Reducer task as input.
Step 1 - Add all hadoop jar files to your java project. Add following jars.
Step 2 - Change the directory to /usr/local/hadoop/sbin
Step 3 - Start all hadoop daemons
Step 4 - Create input.txt file. In my case, i have stored input.txt in /home/hduser/Desktop/hadoop/ directory.
Step 5 - Add following lines to input.txt file.
Step 6 - Make a new input directory in HDFS
Step 7 - Copy the input.txt from local file system to HDFS.
Step 8 - Run your Combiner program by submitting java project jar file to hadoop. Creating jar file is left to you.
Step 9 - Now you can see the output files.
Step 10 - Dont forget to stop hadoop daemons.
Please share this blog post and follow me for latest updates on
Labels : Hadoop Standalone Mode Installation Hadoop Pseudo Distributed Mode Installation Hadoop Fully Distributed Mode Installation Hadoop HDFS commands usage Hadoop Commissioning and Decommissioning DataNode Hadoop Mapper/Reducer Java Example Hadoop WordCount Java Example Hadoop Partitioner Java Example Hadoop HDFS operations using Java Hadoop Distributed Cache Java Example