Hadoop Mapreduce中wordcount 过程解析
将文件split
文件1: 分割结果:
hello world <0, "hello world">
this is wordcount <12,"this is wordcount">
文件2:
hello china <0,"hello china">
hello IT <12,"hello IT">
测试文件较小,所以一般测试文件就是一个split
MapReduce 框架完成了以上分割
Then,将分割好的<key ,value > 交给用户自定义的map 方法进行处理,生成新的<key,value>:
<0, "hello world"> map() <hello,1> <world,1>
<12,"this is wordcount"> map() <this,1> <is,1> <wordcount,1>
<0,"hello china"> map() <hello,1> <china,1>
<12,"hello IT"> map() <hello,1><IT,1>
map() reduce() 中间有个shuffle :
<hello,1> <world,1> shuffle () <hello,1>
<this,1> <is,1> <wordcount,1> shuffle () <is,1>
<wordcount,1>
<world,1>
<hello,1> <china,1> shuffle () <china,1>
<hello,1> <IT,1> shuffle () <hello,1>
<hello,1>
<IT,1>
分组,将相同的key 合并在一起:
<hello,1> <hello,list(1)>
<is,1> <is,list(1)>
<wordcount,1> <wordcount,list(1)>
<world,1> <world,list(1)>
<china,1> <china,list(1)>
<hello,1>
<hello,1> <hello,list(2)>
<IT,1> <IT,1>
<china,list(1)>
<hello,list(1,2)>
<is,list(1)>
<wordcount,list(1)>
<world,list(1)>
<IT,list(1)>
得到最新的<key,value> 之后,再交给用户的reduce()方法,得到最新的<key,value >,并组为wordcount 的结果输出:
<china,1>
<hello,3>
<is,1>
<wordcount,1>
<world,1>
<IT,1>
Hadoop Mapreduce中wordcount 过程解析的更多相关文章
- MapReduce 示例:减少 Hadoop MapReduce 中的侧连接
摘要:在排序和reducer 阶段,reduce 侧连接过程会产生巨大的网络I/O 流量,在这个阶段,相同键的值被聚集在一起. 本文分享自华为云社区<MapReduce 示例:减少 Hadoop ...
- 三.hadoop mapreduce之WordCount例子
目录: 目录见文章1 这个案列完成对单词的计数,重写map,与reduce方法,完成对mapreduce的理解. Mapreduce初析 Mapreduce是一个计算框架,既然是做计算的框架,那么表现 ...
- Hadoop Mapreduce 案例 wordcount+统计手机流量使用情况
mapreduce设计思想 概念:它是一个分布式并行计算的应用框架它提供相应简单的api模型,我们只需按照这些模型规则编写程序,即可实现"分布式并行计算"的功能. 案例一:word ...
- Hadoop : MapReduce中的Shuffle和Sort分析
地址 MapReduce 是现今一个非常流行的分布式计算框架,它被设计用于并行计算海量数据.第一个提出该技术框架的是Google 公司,而Google 的灵感则来自于函数式编程语言,如LISP,Sch ...
- Mapreduce中maptask过程详解
一.Maptask并行度与决定机制 1.一个job任务的map阶段的并行度默认是由该任务的大小决定的: 2.一个split切分分配一个maprask来并行处理: 3.默认情况下,split切分的大小等 ...
- Hadoop MapReduce的Shuffle过程
一.概述 理解Hadoop的Shuffle过程是一个大数据工程师必须的,笔者自己将学习笔记记录下来,以便以后方便复习查看. 二. MapReduce确保每个reducer的输入都是按键排序的.系统执行 ...
- Hadoop MapReduce中压缩技术的使用
Compression and Input Splits 当我们使用压缩数据作为MapReduce的输入时,需要确认数据的压缩格式是否支持切片? 假设HDFS中有一个未经压缩的大小为1GB的文 ...
- Hadoop Mapreduce中shuffle 详解
MapReduce 里面的shuffle:描述者数据从map task 输出到reduce task 输入的这段过程 Shuffle 过程: 首先,map 输出的<key,value > ...
- Hadoop Mapreduce 中的Partitioner
Partitioner的作用的对Mapper产生的中间结果进行分片,以便将同一分组的数据交给同一个Reduce处理,Partitioner直接影响Reduce阶段的负载均衡. MapReduce提供了 ...
随机推荐
- javaScript---RegExp
字符串是编程时涉及到的最多的一种数据结构,对字符串进行操作的需求几乎无处不在.比如判断一个字符串是否是合法的Email地址,虽然可以编程提取@前后的子串,再分别判断是否是单词和域名,但这样做不但麻烦, ...
- [LeetCode] Custom Sort String 自定义排序的字符串
S and T are strings composed of lowercase letters. In S, no letter occurs more than once. S was sort ...
- [EOJ Monthly 2018.10][C. 痛苦的 01 矩阵]
题目链接:C. 痛苦的 01 矩阵 题目大意:原题说的很清楚了,不需要简化_(:з」∠)_ 题解:设\(r_i\)为第\(i\)行中0的个数,\(c_j\)为第\(j\)列中0的个数,\(f_{i,j ...
- Python练手例子(6)
31.请输入星期几的第一个字母来判断一下是星期几,如果第一个字母一样,则继续判断第二个字母. 程序分析:用情况语句比较好,如果第一个字母一样,则判断用情况语句或if语句判断第二个字母. letter ...
- C#获取变更过的DataTable记录的实现方法
本文实例讲述了C#获取变更过的DataTable记录的实现方法,是一个非常实用的功能!具体实现方法如下: 首先DataTable可以看做是一个物理表的内存式存储,每一个DataRow都有一个属性叫做R ...
- SSIS - 1.简介
一.什么是SSIS? 1)SSIS全称为Microsoft SQL Server Integration Services. 2)ETL全称为Extraction, Transformation an ...
- 如何设置记事本( .txt文件)的默认编码为UTF-8?
1.在桌面新建一个文本文档,不要写入任何内容,然后手动另存为,将此文档编码改为UTF-8,然后将文件名字改为template.txt: 2.再将template.txt移动到C:\Windows\Sh ...
- spring boot application.properties 属性详解
2019年3月21日17:09:59 英文原版: https://docs.spring.io/spring-boot/docs/current/reference/html/common-appli ...
- python连接服务器上传文件,后台执行命令
上传文件 import os import paramikoimport logging from django.core.cache import cache from YunTai import ...
- C++———库函数cstring及string方法解读
1.string与cstring区别 <string>是C++标准库头文件.包含了拟容器class std::string的声明(不过class string事实上只是basic_stri ...