1.  jobtracker做了分离,分成了resourceManager和nodemanager;

2.  MR变成了和HBase和Hive等一样的yarn上面的一个应用;

3.  1.x的默认块大小为64M,2.x的默认块大小为128M;

4.  在2.x中除了datanode要向namenode报告status,nodemanager也要向ResourceManager报告status

5. MR API差别

旧的WordCount

 package org.apache.hadoop.mapred;

 ... ...

 public class WordCount extends Configured implements Tool {

   public static class MapClass extends MapReduceBase
implements Mapper<LongWritable, Text, Text, IntWritable> { ... ... public void map(LongWritable key, Text value,
OutputCollector<Text, IntWritable> output,
Reporter reporter) throws IOException {
... ...
}
} public static class Reduce extends MapReduceBase
implements Reducer<Text, IntWritable, Text, IntWritable> { public void reduce(Text key, Iterator<IntWritable> values,
OutputCollector<Text, IntWritable> output,
Reporter reporter) throws IOException {
... ...
}
} static int printUsage() {
System.out.println("wordcount [-m <maps>] [-r <reduces>] <input> <output>");
ToolRunner.printGenericCommandUsage(System.out);
return -1;
} public int run(String[] args) throws Exception {
... ...
return 0;
}
public static void main(String[] args) throws Exception {
int res = ToolRunner.run(new Configuration(), new WordCount(), args);
System.exit(res);
} }

新的WordCount

 package org.apache.hadoop.examples;

 ... ...

 public class WordCount {

   public static class TokenizerMapper
extends Mapper<Object, Text, Text, IntWritable>{ ... ... public void map(Object key, Text value, Context context
) throws IOException, InterruptedException {
... ...
}
} public static class IntSumReducer
extends Reducer<Text,IntWritable,Text,IntWritable> {
private IntWritable result = new IntWritable(); public void reduce(Text key, Iterable<IntWritable> values,
Context context
) throws IOException, InterruptedException {
... ...
}
} public static void main(String[] args) throws Exception {
... ...
System.exit(job.waitForCompletion(true) ? 0 : 1);
}
}

6.


最新文章

  1. 使用jOrgChart插件, 异步加载生成组织架构图
  2. Python3 Socket网络编程
  3. evil program
  4. CSS3如何去除 inline block 元素之间多出的空格
  5. 关于java按位操作运算
  6. Oracle函数题
  7. Linux指令--cat,tac
  8. 读取FTP 图片文件,并显示,非下载
  9. 深度优先遍历(DFS)(转)
  10. linux 进阶命令
  11. 前端里面如何进行搜索引擎优化(SEO)
  12. 【学习】数据处理基础知识(汇总和计算描述统计)【pandas】
  13. Partition Numbers的计算
  14. 进程池的map方法
  15. SQLServer&#160;SQL连接查询深度探险(摘录
  16. Android笔记之 网络http通信
  17. NLayerAppV3--DDD之领域层
  18. SQL Server 跨服务器快速数据转移
  19. 图解在Eclipse中如何上传项目到svn
  20. vim添加复制(crtl+c),粘贴(ctrl+v)ctrl+A 等快捷键

热门文章

  1. bzoj 1025 [SCOI2009]游戏(置换群,DP)
  2. .net中的&quot;异步&quot;-手把手带你体验
  3. linux 下载软件
  4. MySQL 主从架构配置详解
  5. javascript !!作用
  6. POJ 3660 Cow Contest (Floyd)
  7. jquery easyui的扩展验证
  8. [iOS 多线程 &amp; 网络 - 2.7] - NSURLCache
  9. ASP.NET(C#)中的try catch异常处理机制
  10. CSS构造列表