Hadoop-mapreduce Summary 1

Source: Internet
Author: User

Prerequisites:

1. In the inputformat <K, V> interface, there are two methods: inputsplit [] getsplits ();

Recordreader <K, V> getrecordreader ();

2. mapreduce job submission and initialization process.

Job submission:

(1) Command Line submission ....

(2) Get the job ID,

Create an HDFS directory (the directory you specified to store the results)

Upload files to HDFS (Application jar packages, XML files, etc)

Generate the split file (that is, call getsplits in the specified inputformat)

(3) Submit a job to jobtracker.

Job initialization:

The scheduler calls jobtracker. initjob () to construct map tasks and reduce tasks and

Initialization.

3. task running process analysis

Overall map task process:

Read: Use recodreader (getrecordreader () in the inputformat you specify)

In inputsplit, key/value pairs are parsed.

Map: Hand over the key/value in the previous step to map () for processing to form a new key/value.

Collect: In map (), call partition. getpartition () to form a triple <key, value, partition> and write it into the memory ring buffer.

Spill: (1) when the memory buffer is full, sort the data in the buffer (first by partition, then by key)

(2) If a combiner exists, the data is aggregated once.

(3) Writing temporary files

Combine: Merge temporary files (in partitions and sorted)

Overall ruduce task process:

Shuffle: copy a piece of data from each map task (by partition)

Merge: Merge files

Sort: sort. When input data of the reduce () function is aggregated by key,

Reduce:


A map (which class is used here) processes a shard. The map () function processes a pair

Key/value.



This article from the "thick and thin hair" blog, please be sure to keep this source http://duanzhenyue.blog.51cto.com/9360091/1553372

Hadoop-mapreduce Summary 1

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.