1.什么是Map? 什么是Reduce?

Map是拆解 Reduce是组装 本治就是分治法

Input --> Split-->Map--->Shuffle(组装)--->Reduce ---->Finalize(高度并行的)

实现代码:

MapReduce如何实现统计单词出现的次数的

Map(string key,  string value)
   #key  :   the  id  of  a  line 
   #value:   the content  of  the  line
   for   each   word  in value:
      OutputTemp(word,1)
        
# Reduce 的过程

Reduce(string key,list valueList)
	#key  :  the  name  of  a  word
    #valueList:  the  appearance of  this  world
    int sum = 0 
    for value in  valueList:
        sum+=value
    OutputFinal(key,sum)

MapReduce 如何实现倒排索引的?

MapReduce的整体结构?

MapReduce整体架构

总结:Map就是一个disassemble Reduce 就是一个assemble