MapReduce:
public class MRDriver extends Configured implements Tool {
@Override
public int run(String[] args) throws Exception {
Job job = Job.getInstance(this.getConf(), "xxx");
job.setJarByClass( MRDriver.class );
Path inputPath = new Path(args[0]);
FileInputFormat.setInputPaths(job,inputPath);
job.setMapperClass(null);
job.setMapOutputKeyClass(null);
job.setMapOutputValueClass(null);
job.setPartitionerClass(null);
job.setGroupingComparatorClass(null);
job.setSortComparatorClass(null);
job.setReducerClass(null);
job.setOutputKeyClass(null);
job.setOutputValueClass(null);
Path outputPath = new Path(args[1]);
FileSystem hdfs = FileSystem.get(this.getConf());
if(hdfs.exists(outputPath)){
hdfs.delete(outputPath,true);
}
FileOutputFormat.setOutputPath(job,outputPath);
boolean isSuccess = job.waitForCompletion(true);
return isSuccess?0:1;
}
public static void main(String[] args) {
Configuration configuration = new Configuration();
try {
int status = ToolRunner.run(configuration, new MRDriver(), args);
System.exit(status);
} catch (Exception e) {
e.printStackTrace();
}
}
}
Mapper:
public class MRMapper extends Mapper<LongWritable,Text,Text,Text>{
@Override
protected void map(LongWritable key, Text value, Context context) throws IOException, InterruptedException {
}
}
Reducer:
public class MRReducer extends Reducer<Text,Text,Text,Text> {
@Override
protected void reduce(Text key, Iterable<Text> values, Context context) throws IOException, InterruptedException {
}
}