1.1、需求
一个稍微复杂的处理逻辑往往需要多个MapReduce程序串联处理,多job的串联可以借助MapReduce框架的JobControl实现1.2、实例
一下有两个MapReduce任务,分别是Flow的SumMR和SortMR,其中有依赖关系:SumMR的输出是SortMR的输入,所以SortMR的启动的在SumMR完成之后具体代码如下:
public statci void main(String[] args) throws Exception{
Configuration conf = new Configuration();
Job jobsum = Job.getInstance(conf);
jobsum.setJarByClass(RunManyJobMR.class);
jobsum.setMapperClass(FlowSumMapper.class);
jobsum.setReducerClass(FlowSumReducer.class);
jobsum.setMapOutputKeyClass(Text.class);
jobsum.setMapOutputValueClass(Flow.class);
jobsum.setCombinerClass(FlowSumReducer.class);
jobsum.setOutputKeyClass(Text.class);
jobsum.setOutputValueClass(Text.class);
FileInputFormat.setInputPaths(jobsum, "d:/flow/input");
FileOutp