hadoop-*-streaming.jar源码浅析

本文主要分析Hadoop Streaming的源码,讲解StreamJob如何实现Tool接口,以及如何处理输入输出、设置作业配置、运行MapReduce任务。重点探讨PipeMapper和PipeReducer在处理map和reduce任务中的角色,包括启动进程、传递数据等过程。
摘要由CSDN通过智能技术生成

Main-Class为HadoopStreaming,主函数:

public static void main(String[] args) throws Exception {
    int returnStatus = 0;
    StreamJob job = new StreamJob();      
    returnStatus = ToolRunner.run(job, args);
    if (returnStatus != 0) {
      System.err.println("Streaming Job Failed!");
      System.exit(returnStatus);
    }
  }


核心类为StreamJob,StreamJob实现了org.apache.hadoop.util.Tool接口,其不带参数的构造函数做了两件事,调用setupOptions()初始化其支持的所有选项,以及初始化config_。

其支持的选项有:

name desc argName max required
input DFS input file(s) for the map step path Integer.MAX_VALUE true
output DFS output directory for the reduce step path 1 true
mapper the streaming command to run cmd 1 false
combiner the streaming command to run cmd 1 false
reducer the streaming command to run cmd 1 false
file file to be shipped in the job jar file file Integer.MAX_VALUE false
dfs Optional,override DFS configu
  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 1
    评论
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值