List of usage examples for org.apache.hadoop.mapreduce Job Job
@Deprecated public Job() throws IOException
From source file:com.sreejith.loganalyzer.mapreduce.LogDriver.java
License:Apache License
public static void main(String[] args) throws Exception { Job job = new Job(); job.setJarByClass(LogDriver.class); job.setJobName("Log Analyzer"); job.setMapperClass(LogMapper.class); job.setPartitionerClass(LogPartitioner.class); job.setCombinerClass(LogReducer.class); job.setReducerClass(LogReducer.class); job.setNumReduceTasks(2);//from w w w. ja v a 2 s . com job.setOutputKeyClass(IntWritable.class); job.setOutputValueClass(IntWritable.class); FileInputFormat.addInputPath(job, new Path(args[0])); FileOutputFormat.setOutputPath(job, new Path(args[1])); job.waitForCompletion(true); }
From source file:com.sudarmuthu.hadoop.countwords.CountWords.java
public static void main(String[] args) throws Exception { if (args.length != 2) { System.err.println("Usage: CountWords <input path> <output path>"); System.exit(-1);//from ww w. j a v a2 s . co m } Job job = new Job(); job.setJarByClass(CountWords.class); job.setJobName("Count Words"); FileInputFormat.addInputPath(job, new Path(args[0])); FileOutputFormat.setOutputPath(job, new Path(args[1])); job.setMapperClass(CountWordsMapper.class); job.setReducerClass(CountWordsReducer.class); job.setOutputKeyClass(Text.class); job.setOutputValueClass(IntWritable.class); System.exit(job.waitForCompletion(true) ? 0 : 1); }