当前位置:网站首页>MapReduce各阶段步骤
MapReduce各阶段步骤
2022-07-29 07:25:00 【万里长江横渡】
Map阶段2个步骤
1、设置InputFormat类,将数据切分为key-value(k1和v1)对,输入到第二步;
2、自定义Map逻辑,将第一步的结果转换成另外的Key-Value(K2和V2)对
Shuffle阶段的4个步骤
3、对输出的Key-Value对进行分区
4、对不同分区的数据按照相同的key进行排序
5、对分组过后的数据进行初步规约,降低数据的网络拷贝
6、对数据进行分组,相同的key和value放入一个集合中
Reduce阶段的2个步骤
7、对多个Map任务的结果进行排序及合并,编写Reduce函数实现自己的逻辑,对输入的key-value进行处理,转换为新的key-value(K3和V3)输出
8、设置OutputFormat处理保存Reduce输出的Key-Value数据。
【Shuffle机制】
(1)Map 方法之后 Reduce 方法之前这段处理过程叫 Shuffle
(2)Map 方法之后,数据首先进入到分区方法,把数据标记好分区,然后把数据发送到环形缓冲区;环形缓冲区默认大小 100m,环形缓冲区达到 80%时,进行溢写;溢写前对数据进行排序,排序按照对 key 的索引进行字典顺序排序,排序的手段快排;溢写产生大量溢写文件,需要对溢写文件进行归并排序;对溢写的文件也可以进行 Combiner 操作,前提是汇总操作,求平均值不行。最后将文件按照分区存储到磁盘,等待 Reduce 端拉取。
(3)每个 Reduce 拉取 Map 端对应分区的数据。拉取数据后先存储到内存中,内存不够了,再存储到磁盘。拉取完所有数据后,采用归并排序将内存和磁盘中的数据都进行排序。在进入 Reduce 方法前,可以对数据进行分组操作。
边栏推荐
- Vue router route cache
- 7-2 calculate the area and perimeter of a regular pentagon (25 points)
- Section 7 - compilation of programs (preprocessing operations) + links
- 请问flink支持sqlServer数据库么?获取sqlServer数据库的变化
- QT连接两个qslite数据库报错QSqlQuery::exec: database not open
- Some learning and understanding of vintage analysis
- Leetcode buckle classic problem -- 4. Find the median of two positively ordered arrays
- 【暑期每日一题】洛谷 P7760 [COCI2016-2017#5] Tuna
- 3-全局异常处理
- jdbc入门
猜你喜欢

2022年深圳杯A题破除“尖叫效应”与“回声室效应”走出“信息茧房”
Scala 高阶(十):Scala中的异常处理

Spingboot integrates the quartz framework to realize dynamic scheduled tasks (support real-time addition, deletion, modification and query tasks)

Use custom annotations to verify the size of the list

Prometheus and grafana

我,28岁,测试员,10月无情被辞:想给还在学测试 的人提个醒......

Leetcode buckle classic problem -- 4. Find the median of two positively ordered arrays

2-unified return class dto object
![【暑期每日一题】洛谷 P6461 [COCI2006-2007#5] TRIK](/img/bf/c0e03f1bf477730f0b3661b3256d1d.png)
【暑期每日一题】洛谷 P6461 [COCI2006-2007#5] TRIK

How to establish EDI connection with Scania in Scania?
随机推荐
CDC source can quit after reading MySQL snapshot split
leetcode力扣经典问题——4.寻找两个正序数组的中位数
一篇长文---深入理解synchronized
【暑期每日一题】洛谷 P6500 [COCI2010-2011#3] ZBROJ
树莓派的启动流程
Segger's hardware anomaly analysis
QT专题:基础部件(按钮类,布局类,输出类,输入类,容器类)
2-统一返回类DTO对象
5-integrate swagger2
3-global exception handling
如何与斯堪尼亚SCANIA建立EDI连接?
[OpenGL] use of shaders
Job 7.28 file IO and standard IO
【暑期每日一题】洛谷 P6320 [COCI2006-2007#4] SIBICE
零数科技深度参与信通院隐私计算金融场景标准制定
Synchronous / asynchronous, blocking / non blocking and IO
Docker's latest super detailed tutorial - docker creates, runs, and mounts MySQL
亚马逊云助手小程序来啦!
Gin service exit
halcon的安装以及在vs2017中测试,vs2017中dll的配置