
10

常见分布式基础设施系统设计图解(六):分布式 MR 系统
source link: https://www.raychase.net/6422
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.

常见分布式基础设施系统设计图解(六):分布式 MR 系统
其实对于 MR(Map Reduce)系统来说,可能更重要的是分治和分步处理的思想,因为现在的基于 MR 的数据处理框架或者平台,在实现上数据处理往往已经和最经典的对于 MR 的理解(最早应该是来自 Google 的那篇论文)有了不少区别。当然,我还是按照之前的做法,把一个典型的 MR 系统简单图示画出来了,这个图相对比较简单。

- 还是老规矩,虚线表示控制流,实线表示数据流。
- 上半部分用户向 Master 这个 job 管理节点提交一个 job 的请求,这个请求被拆解为若干个 task,下半部分的 slave 节点完成 task 的跟踪和执行。
- 具体执行逻辑上:
- 首先的输入文件,可以是多个已经拆分了的小文件,也可以是一个大文件,但是支持随机块读取。这个文件存储系统可以是 HDFS,也可以是 S3、GFS。
- 输入文件的每一个 split 块被读取到每个 Mapper 上面去,Mapper 按照规则对数据进行映射转换。
- 在 shuffle 阶段,数据根据 hash 的归类规则被投递到相应的 Reducer 上面去。
- 在 Reducer 上,数据被 reduce 成为最终结果的一部分,并写入输出文件。
- 给一个 “统计文本单词出现次数” 的具体例子,分别列出每一阶段的具体输出:
- input: “Good dog. Dog is good! Good Cat. Cat is good! Human is bad!”
- split:
- A: “Good dog. Dog is good!”
- B: “Good Cat. Cat is good!”
- C: “Human is bad!”
- map:
- A: {“dog”: 2, “good”: 2, “is”: 1}
- B: {“cat”: 2, “good”: 2, “is”: 1}
- C: {“human”: 1, “bad”: 1, “is”: 1}
- shuffle:
- A: {“cat”: [2], “dog”: [2], “good”: [2, 2]}
- B: {“human”: [1], “is”: [1, 1, 1]}
- reduce:
- A: {“cat”: 2, “dog”: 2, “good”: 4}
- B: {“human”: 1, “is”: 3}
- output: {“cat”: 2, “dog”: 2, “good”: 4, “human”: 1, “is”: 3}
文章未经特殊标明皆为本人原创,未经许可不得用于任何商业用途,转载请保持完整性并注明来源链接 《四火的唠叨》
Posted in System and ArchitectureTagged MapReduce, 图解笔记, 基础设施, 系统设计 394 次阅读
Leave a Reply Cancel reply
Your email address will not be published.
Comment
Name
Website
Save my name, email, and website in this browser for the next time I comment.
Recommend
About Joyk
Aggregate valuable and interesting links.
Joyk means Joy of geeK