|NO.Z.00029|——————————|BigDataEnd|——|Hadoop&MapReduce.V02|——|Hadoop.v02|MapReduce编程规范|

一、MapReduce编程规范及示例编写
### --- Mapper类

~~~     用户自定义一个Mapper类继承Hadoop的Mapper类
~~~     Mapper的输入数据是KV对的形式(类型可以自定义)
~~~     Map阶段的业务逻辑定义在map()方法中
~~~     Mapper的输出数据是KV对的形式(类型可以自定义)
~~~     注意:map()方法是对输入的一个KV对调用一次!!
### --- Reducer类

~~~     用户自定义Reducer类要继承Hadoop的Reducer类
~~~     Reducer的输入数据类型对应Mapper的输出数据类型(KV对)
~~~     Reducer的业务逻辑写在reduce()方法中
~~~     Reduce()方法是对相同K的一组KV对调用执行一次
### --- Driver阶段

~~~     创建提交YARN集群运行的Job对象,
~~~     其中封装了MapReduce程序运行所需要的相关参数入输入数据路径,
~~~     输出数据路径等,也相当于是一个YARN集群的客户端,主要作用就是提交我们MapReduce程序运行。

 
 
 
 
 
 
 
 
 

Walter Savage Landor:strove with none,for none was worth my strife.Nature I loved and, next to Nature, Art:I warm'd both hands before the fire of life.It sinks, and I am ready to depart
                                                                                                                                                   ——W.S.Landor

 

 

posted on 2022-04-07 14:02  yanqi_vip  阅读(19)  评论(0)    收藏  举报

导航