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