域名

hadoop中mapreduce的常用类

时间:2010-12-5 17:23:32  作者:域名   来源:IT科技类资讯  查看:  评论:0
内容摘要:复制publicclassMyAppextendsConfiguredimplementsTool{ publicintrun(String[]args)throwsExcept

hadoop中mapreduce的常用类
复制public class MyApp extends Configured implements Tool {    public int run(String[] args) throws Exception {    // 即将被ToolRunner执行的用类Configuration    Configuration conf = getConf();    // 使用conf建立JobConf    JobConf job = new JobConf(conf, MyApp.class);    // 执行客户端参数    Path in = new Path(args[1]);    Path out = new Path(args[2]);    // 指定job相关的服务器租用参数         job.setJobName("my-app");    job.setInputPath(in);    job.setOutputPath(out);    job.setMapperClass(MyApp.MyMapper.class);    job.setReducerClass(MyApp.MyReducer.class);    *    // 提交job,企商汇然后监视进度直到job完成    JobClient.runJob(job);   }     public static void main(String[] args) throws Exception {    // 让ToolRunner 处理命令行参数     int res = ToolRunner.run(new Configuration(),用类 new Sort(), //这里封装了GenericOptionsParser解析args    System.exit(res);   }    }    1.2.3.4.5.6.7.8.9.10.11.12.13.14.15.16.17.18.19.20.21.22.23.24.25.26.27.28.29.30.31.香港云服务器
copyright © 2025 powered by 编程之道  滇ICP备2023006006号-34sitemap