下面写一个default mapreduce 的程序:

 import org.apache.hadoop.mapreduce.Mapper;
 import org.apache.hadoop.mapreduce.Reducer;
 import org.apache.hadoop.conf.Configuration;
 import org.apache.hadoop.conf.Configured;
 import org.apache.hadoop.fs.Path;
 import org.apache.hadoop.util.Tool;
 import org.apache.hadoop.util.ToolRunner;
 import org.apache.hadoop.mapreduce.Job;
 import org.apache.hadoop.mapreduce.lib.input.FileInputFormat;
 import org.apache.hadoop.mapreduce.lib.output.FileOutputFormat; 

 public class DefaultMapReduce extends Configured implements Tool {
     @Override
     public int run(String[] args) throws Exception {
         Configuration conf = getConf();
         Job job = Job.getInstance(conf);
         job.setJarByClass(getClass());
         job.setNumReduceTasks(10);

         FileInputFormat.addInputPath(job, new Path(args[0]));
         FileOutputFormat.setOutputPath(job, new Path(args[1]));

         return job.waitForCompletion(true) ? 0 : 1;
     }

     public static void main(String[] args) throws Exception {
         ToolRunner.run(new DefaultMapReduce(), args);
     }
 }

hadoop2.2编程:从default mapreduce program 来理解mapreduce的更多相关文章

  1. hadoop2.2编程:使用MapReduce编程实例(转)

    原文链接:http://www.cnblogs.com/xia520pi/archive/2012/06/04/2534533.html 从网上搜到的一篇hadoop的编程实例,对于初学者真是帮助太大 ...

  2. Writing an Hadoop MapReduce Program in Python

    In this tutorial I will describe how to write a simpleMapReduce program for Hadoop in thePython prog ...

  3. 用Python语言写Hadoop MapReduce程序Writing an Hadoop MapReduce Program in Python

    In this tutorial I will describe how to write a simple MapReduce program for Hadoop in the Python pr ...

  4. Java中的函数式编程(七)流Stream的Map-Reduce操作

    写在前面 Stream 的 Map-Reduce 操作是Java 函数式编程的精华所在,同时也是最为复杂的部分.但一旦你啃下了这块硬骨头,那你就真正熟悉Java的函数式编程了. 如果你有大数据的编程经 ...

  5. MapReduce教程(一)基于MapReduce框架开发<转>

    1 MapReduce编程 1.1 MapReduce简介 MapReduce是一种编程模型,用于大规模数据集(大于1TB)的并行运算,用于解决海量数据的计算问题. MapReduce分成了两个部分: ...

  6. 实例理解mapreduce任务的串行运行过程

    一.准备: eclipse,hadoop集群 注意:为了方便测试和修改,我用的是 windows 连接hadoop集群,这样在windows 下直接就能够执行 mapreduce 任务,方便程序调试. ...

  7. MapReduce任务分析与讨论MapReduce job explained

    In the last post we saw how to run a MapReduce job on Hadoop. Now we're going to analyze how a MapRe ...

  8. Top N之MapReduce程序加强版Enhanced MapReduce for Top N items

    In the last post we saw how to write a MapReduce program for finding the top-n items of a dataset. T ...

  9. 深入理解MapReduce的架构及原理

    1. MapReduce 定义 Hadoop 中的 MapReduce是一个使用简单的软件框架.基于它写出来的应用程序能够执行在由上千个商用机器组成的大型集群上,并以一种可靠容错式并行处理TB级别的数 ...

随机推荐

  1. 三【相关度 相似度查询与计算】相似度到大数据查找之Mysql 文章匹配的一些思路与提高查询速度

    记录下,在上2回的数据基础之上,附带一个互信息(MI,Mutual Information)可以计算词之间的相关度 标准互信息 MI(X,Y)=log2p(x,y)/p(x)p(y) 值越大于0 则趋 ...

  2. Oracle每10天删除数据,并重建索引

    declare datDateFrom date := to_date('2010/08/01 00:00:00','yyyy/mm/dd hh24:mi:ss'); datDateTo date; ...

  3. JS原型与原型链终极详解(转)

    JavaScript原型及原型链详解 一. 普通对象与函数对象 JavaScript 中,万物皆对象!但对象也是有区别的.分为普通对象和函数对象,Object,Function 是JS自带的函数对象. ...

  4. IP address/地址 检查

    1.Determine if a string is a valid IP address in C Beej's Guide to Network Programming 2.9.14. inet_ ...

  5. JS中undefined和null的区别

    在写JS脚本的时候,经常会碰到“为空”的判断,其中主要有null和undefined的判断.这两个为空判断的主要区别是: 1) null是JS的关键字,是语法特性.undefined是全局对象的属性, ...

  6. 关于$.fn

    今天看一篇文章,里面的一段代码出现了$.fn,第一次见到这样的写法,于是跑去问度娘...代码如下: $.fn.scrollUnique = function() { return $(this).ea ...

  7. Android Studio第一次提交git使用

    安装: Git客户端网址:http://git-scm.com/download/ 根据自己的使用平台下载对应的客户端.这里以Mac系统为例,当客户端软件安装配置完毕后,打开AS的配置面板,找到Git ...

  8. vb delphi7、2010 csharp vb.net空白测试程序

    工作中难免在网上看到一段不错的代码,希望能够拿来测试一次,为了避免每次测试都要新建一个空白测试程序,索性预先建立好,要用的时候复制一遍,然后打开直接粘贴需要测试的代码进行测试.

  9. Django基本操作命令

    1.新建一个django项目 django-admin.py startproject project-name 2.新建一个app python manage.py startapp app-nam ...

  10. Python 爬虫入门(requests)

    相信最开始接触Python爬虫学习的同学最初大多使用的是urllib,urllib2.在那之后接触到了第三方库requests,requests完全能满足各种http功能,真的是好用爆了 :D 他们是 ...