Skip to content

Instantly share code, notes, and snippets.

@sajithdilshan
Created November 21, 2017 08:18
Show Gist options
  • Save sajithdilshan/a3f8ab91668cd706ad9ff64c6468b318 to your computer and use it in GitHub Desktop.
Save sajithdilshan/a3f8ab91668cd706ad9ff64c6468b318 to your computer and use it in GitHub Desktop.
public static void main(String[] args) throws Exception {
Configuration conf = new Configuration();
conf.set("fs.defaultFS", "hdfs://localhost:9000");
Job job = Job.getInstance(conf, "word count");
job.setJarByClass(VisitorPathCount.class);
job.setMapperClass(TokenizerMapper.class);
job.setCombinerClass(IntSumReducer.class);
job.setReducerClass(IntSumReducer.class);
job.setOutputKeyClass(Text.class);
job.setOutputValueClass(IntWritable.class);
FileInputFormat.addInputPath(job, new Path("/s3logs"));
FileOutputFormat.setOutputPath(job, new Path("/tmp/result.txt"));
System.exit(job.waitForCompletion(true) ? 0 : 1);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment