mapreduce-查找最高气温的Main类

package com;


import org.apache.hadoop.fs.Path;
import org.apache.hadoop.io.IntWritable;
import org.apache.hadoop.io.Text;
import org.apache.hadoop.mapreduce.Job;
import org.apache.hadoop.mapreduce.lib.input.FileInputFormat;
import org.apache.hadoop.mapreduce.lib.output.FileOutputFormat;


public class MaxTemperature {


public static void main(String[] args) throws Exception{
// TODO Auto-generated method stub
if(args.length != 2){
System.out.println("最高温度的输入路径和输出路径");
System.exit(-1);
}

Job job = new Job();
job.setJarByClass(MaxTemperature.class);
job.setJobName("Max temperature");

//这里的输入和输出地址,自定义

FileInputFormat.addInputPath(job, new Path("D://BaiduYunDownload//CentOS下配置SSL.doc"));
FileOutputFormat.setOutputPath(job, new Path("D://BaiduYunDownload"));

job.setMapperClass(MaxTemperatureMapper.class);
job.setReducerClass(MaxTemperatureReducer.class);

job.setOutputKeyClass(Text.class);
job.setOutputValueClass(IntWritable.class);

System.out.println(job.waitForCompletion(true) ? 0 : 1);

}


}

你可能感兴趣的:(mapreduce-查找最高气温的Main类)