2013-02-04 2 views
0

oozie를 사용하여 mapreduce에서 단어 개수 prg를 실행하려고 할 때 입력 레코드를 읽고 표시합니다. 내 매퍼 및 감속기 클래스를 호출하지 않는 것 같아요. 나는 새 API를 사용하고 있기 때문에 workflow.xml에도 new-api 속성 태그를 포함 시켰습니다.Map-Reduce와 Oozie의 통합 오류

지도-감소 조각 :

public class WordCount { 

    public static class Map extends Mapper<LongWritable, Text, Text, IntWritable> { 
    private final static IntWritable one = new IntWritable(1); 
    private Text word = new Text(); 

    public void map(LongWritable key, Text value, Context context) throws IOException, InterruptedException { 
     String line = value.toString(); 
     StringTokenizer tokenizer = new StringTokenizer(line); 
     while (tokenizer.hasMoreTokens()) { 
      word.set(tokenizer.nextToken()); 
      context.write(word, one); 
     } 
} 

}

public static class Reduce extends Reducer<Text,IntWritable,Text,IntWritable> { 

    public void reduce(Text key, Iterable<IntWritable> values, Context context) 
     throws IOException, InterruptedException { 
     int sum = 0; 
     for (IntWritable val : values) { 
      sum += val.get(); 
     } 
      context.write(key, new IntWritable(sum)); 
    } 

}

내 workflow.xml :

<?xml version="1.0" encoding="UTF-8"?> 
    <workflow-app xmlns='uri:oozie:workflow:0.1' name="wordcount"> 
    <start to="wc-node" /> 
    <action name="wc-node"> 
    <map-reduce> 
     <job-tracker>${jobTracker}</job-tracker> 
     <name-node>${nameNode}</name-node> 
     <prepare> 
      <delete path="${nameNode}/user/${wf:user()}/${wordcountRoot}/output- data/${outputDir}"/> 
     </prepare> 

     <configuration> 

      <property> 
       <name>mapred.mapper.new-api</name> 
       <value>true</value> 
      </property> 

      <property> 
       <name>mapred.reducer.new-api</name> 
       <value>true</value> 
       </property> 

      <property> 
       <name>mapreduce.map.class</name> 
       <value>WordCount.Map</value> 
      </property> 

      <property> 
       <name>mapreduce.reduce.class</name> 
       <value>WordCount.Reduce</value> 
      </property> 

      <property> 
       <name>mapred.output.key.class</name> 
       <value>org.apache.hadoop.io.Text</value> 
      </property> 

      <property> 
       <name>mapred.output.value.class</name> 
       <value>org.apache.hadoop.io.IntWritable</value> 
      </property> 

      <property> 
       <name>mapred.map.tasks</name> 
       <value>1</value> 
      </property> 

      <property> 
       <name>mapred.input.dir</name> 
       <value>/user/${wf:user()}/${wordcountRoot}/input-data</value> 
      </property> 
      <property> 
       <name>mapred.output.dir</name> 
       <value>/user/${wf:user()}/${wordcountRoot}/output-data/${outputDir}</value> 
      </property> 

      <property> 
       <name>mapred.job.queue.name</name> 
       <value>${queueName}</value> 
      </property> 

      <property> 
      <name>mapreduce.job.acl-view-job</name> 
      <value>*</value> 
      </property> 

      <property> 
       <name>oozie.launcher.mapreduce.job.acl-view-job</name> 
       <value>*</value> 
      </property> 

     </configuration> 

    </map-reduce> 

    <ok to="end" /> 
    <error to="fail" /> 
</action> 

<kill name="fail"> 
    <message>Map/Reduce failed</message> 
</kill> 
<end name="end" /> 

이 링크는 https://cwiki.apache.org/OOZIE/map-reduce-cookbook.html이지만 아직 행운은 없습니다. any1이이 문제를 겪었 으면 어디로 잘못 가고 있는지 안내해주세요.

미리 감사드립니다.

답변

0

문제 해결 ... 새로운 맵리 듀스 API..we을 사용하면 맵퍼 및 감속기 클래스 이름으로 "$"기호 앞에 할 필요가 있지만 :

<property> 
<name>mapreduce.map.class</name> 
<value>oozie.WordCount$Map</value> 
</property> 
<property> 
<name>mapreduce.reduce.class</name> 
<value>oozie.WordCount$Reduce</value> 
</property>