Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package Topics;
- import java.io.IOException;
- import Topics.MyMapper;
- import Topics.MyReducer;
- //import mapreduce.WordCountJobClient;
- import org.apache.hadoop.conf.Configuration;
- 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 ObamaSpeech {
- public static void main(String[] arg) throws IOException, ClassNotFoundException, InterruptedException{
- Configuration conf = new Configuration();
- Job job = Job.getInstance(conf, "word count");
- job.setJarByClass(ObamaSpeech.class);
- job.setMapperClass(MyMapper.class);
- job.setCombinerClass(MyReducer.class);
- job.setReducerClass(MyReducer.class);
- job.setOutputKeyClass(Text.class);
- job.setOutputValueClass(IntWritable.class);
- FileInputFormat.addInputPath(job, new Path(arg[0]));
- FileOutputFormat.setOutputPath(job, new Path(arg[1]));
- System.exit(job.waitForCompletion(true) ? 0 : 1);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement