예제 #1
0
  /** The actual main() method for our program; this is the "driver" for the MapReduce job. */
  public static void main(String[] args) {
    JobClient client = new JobClient();
    JobConf conf = new JobConf(SearchKeywords.class);

    conf.setJobName("SearchKeywords");

    conf.setOutputKeyClass(Text.class);
    conf.setOutputValueClass(Text.class);

    FileInputFormat.addInputPath(conf, new Path(args[0]));
    FileOutputFormat.setOutputPath(conf, new Path(args[1]));
    conf.set("keywords", args[2]);
    conf.setMapperClass(SearchKeyMapper.class);
    conf.setReducerClass(SearchKeyReducer.class);

    client.setConf(conf);

    try {
      JobClient.runJob(conf);
    } catch (Exception e) {
      e.printStackTrace();
    }
  }