一、Hadoop版本特性

MRv1

第一代计算框架,由编程模型和运行时环境两部分组成。

编程模型是,将数据进行map操作,然后进行reduce操作,最后将计算结果存储到HDFS中。

运行时环境是,由JobTracker和TaskTracker组成,JobTracker进行资源管理和作业控制。TaskTracker负责接收JobTracker分配的任务并执行。

YARN/MRv2

针对MRv1的问题,提出YARN资源管理框架,将JobTracker中的资源管理和作业控制分开,资源管理由ResourceManager进程实现,作业控制由ApplicationMaster进程实现。

二、模型概述

The MapReduce framework operates exclusively on <key, value> pairs, that is, the framework views the input to the job as a set of <key, value> pairs and produces a set of <key, value> pairs as the output of the job, conceivably of different types.

The key and value classes have to be serializable by the framework and hence need to implement the Writable interface. Additionally, the key classes have to implement the WritableComparable interface to facilitate sorting by the framework.

Input and Output types of a MapReduce job:

(input) <k1, v1> -> map -> <k2, v2> -> combine -> <k2, v2> -> reduce -> <k3, v3> (output)

map()

对多个key/value进行处理产生对应的新的key/value。

reduce()

对key/value进行处理,生成最终结果。

MapReduce架构

实现一个MapReduce程序

对数据进行处理。找出所有年份中的最高气温。

引入Jar包

<!-- hadoop mapreduce编程所需jars -->
<dependency>
<groupId>org.apache.hadoop</groupId>
<artifactId>hadoop-common</artifactId>
<version>3.2.0</version>
</dependency>
<dependency>
<groupId>org.apache.hadoop</groupId>
<artifactId>hadoop-hdfs</artifactId>
<version>3.2.0</version>
</dependency>
<dependency>
<groupId>org.apache.hadoop</groupId>
<artifactId>hadoop-mapreduce-client-core</artifactId>
<version>3.2.0</version>
</dependency>
<dependency>
<groupId>org.apache.hadoop</groupId>
<artifactId>hadoop-client</artifactId>
<version>3.2.0</version>
</dependency>
<dependency>
<groupId>commons-cli</groupId>
<artifactId>commons-cli</artifactId>
<version>1.2</version>
</dependency>

MapReduce模型


Hadoop MapReduce is a software framework for easily writing applications which process vast amounts of data (multi-terabyte data-sets) in-parallel on large clusters (thousands of nodes) of commodity hardware in a reliable(可靠的), fault-tolerant manner(方式).

MR是一个软件框架,可以简化编写应用,用于在分布式环境下,用一种可用、容错的方式处理大规模数据。


A MapReduce job usually splits the input data-set into independent chunks(块、片) which are processed by the map tasks in a completely parallel manner. The framework sorts the outputs of the maps, which are then input to the reduce tasks. Typically both the input and the output of the job are stored in a file-system. The framework takes care of scheduling tasks, monitoring them and re-executes the failed tasks.

一个MR任务,通常将输入的数据集用map任务以完全并行的方式处理成独立的块。

参考文档

Hadoop技术内幕:深入解析MapReduce架构设计与实现原理

最新文章

  1. C语言dll文件的说明以及生成、使用方法
  2. 伪Acmer的推理(dfs/bfs)
  3. LVS-DR工作原理
  4. iOS - UIWebView
  5. 学习记录 彻底搞清 C#中a++与++a的区别
  6. Linux系统目录分析
  7. 关于IOS中的delegate必须知道的事情
  8. 【转】JAVA之网络编程
  9. Java中的数组排序
  10. CG之基本光照模型计算公式
  11. std::list 源代码解析
  12. POJ 3625 最小生成树 Prim C++
  13. docker生态系统
  14. Libgdx 1.6.0发布,跨平台游戏开发框架
  15. ES5 &amp; ES6 基础
  16. jsp页面&lt;%@ page报错问题
  17. Logistic Regression(逻辑回归)
  18. (map string)Crazy Search hdu1381
  19. [Oracle]GoldenGate官方文档
  20. 洛谷P4043 支线剧情

热门文章

  1. JUC - Monitor监控ThreadPoolExecutor
  2. angular http interceptors 拦截器使用分享
  3. 全网最easy的better-scroll实现上拉加载和下拉刷新
  4. 记录axios在IOS上不能发送的问题
  5. 英语wacche腕表
  6. 【体系结构】有关Oracle SCN知识点的整理
  7. C#创建DataTable(转载)
  8. Apache Flink 零基础入门(转)
  9. RocketMQ-c#代码
  10. Python 多线程爬取站酷(zcool.com.cn)图片