Hadoop Learning seventh time: About MapReduce

Source: Internet
Author: User

MapReduce is a distributed computing model. Composed of the map and reduce two phases, the user only needs to implement the map () and reduce () two functions to achieve distributed computing. The formal parameters of these two functions are key,value pairs, which represent the input information of the function.

To perform the steps:

1. Map Task Processing

1.1 Read input file contents, parse into key, value pair. For each line of the input file, parse to key, value pair. Each key-value pair is called once to the map function.

1.2 Write your own logic, the input key, value processing, converted to a new key, value output.

1.3 Partition the Output key, value.

1.4 The data of different partitions are sorted and grouped according to key. The value of the same key is placed in a collection.

1.5 (optional) The data after grouping is normalized.

2.reduce Task Handling

2.1 The output of multiple map tasks, according to different partitions, through the network copy to a different reduce node.

2.2 Merge and sort the output of multiple map tasks. Write the reduce function's own logic, the input key, value processing, converted to a new key, value output.

2.3 Save the output of reduce to a file.

Example: Implementing Wordcountapp

Hadoop Learning seventh time: About MapReduce

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.