hadoop

MapReduce架构师1- 机制和架构

2020-08-15  本文已影响0人  fat32jin

1 MR 架构概述 0:33:00 ~ 1:20:00

1采用职责链设计模式

数据源 InputFormat RecordReader 实现类 TextInputFormat LineRecordReader
一阶段 Mapper
二阶段 Partio ner Sorter Combiner
三阶段 reduce
输出 OutputFormat RecordWrtier

job 是核心

job.getinstance(conf)
job.setmapperClass(xxx)
job.setReduceClass(xxx)
job.setpartionerClass(xxx)

job.submit()

核心对象2: Context上下文对象

boolean result = context.nextkeyvalue()
inkey = context.getCurrentKey()
invalue = context.getCurrentValue()
( inkey,invalue) = ( outkey ,outvalue)

context.write(outkey , outvalue)

2个实现类 MapContext ReduceContext

内部 装饰模式

2 Mapper阶段 0:54:00 ~ 1:04:00

org.apache.hadoop.mapreduce.Mapper 类
map方法

3 整体流程 1:04:00 ~1:25:00

上一篇 下一篇

猜你喜欢

热点阅读