2013-08-17 30 views
0

嗨iam對這個hadoop非常陌生,iam試圖執行一個簡單的mapreduce作業鏈,但是在我的代碼還原器中沒有執行。這裏有我寫的簡單代碼還原器沒有在hadoop中執行

這是我的映射器代碼 ​​

這是我簡單的減速碼

@Override 
public void reduce(Text arg0, Iterator<IntWritable> arg1, 
     OutputCollector<Text, IntWritable> arg2, Reporter arg3) 
     throws IOException { 
    // TODO Auto-generated method stub 
    System.out.println("in reducer"); 

} 

這是一個運行工作主類

JobConf jobConf = new JobConf(jobrunner.class); 
jobConf.setJobName("Chaining"); 

FileInputFormat.setInputPaths(jobConf, new Path("hdfs://localhost:9000/employee_data.txt")); 
FileOutputFormat.setOutputPath(jobConf,new Path("hdfs://localhost:9000/chain3.txt")); 

JobConf conf1 = new JobConf(false); 

ChainMapper.addMapper(jobConf,chainmap.class,LongWritable.class,Text.class,Text.class,IntWritable.class,true,conf1); 

JobConf conf2 = new JobConf(false); 

ChainReducer.setReducer(jobConf, chainreduce.class,Text.class,IntWritable.class,Text.class,IntWritable.class,true,conf2); 

JobClient.runJob(jobConf); 

不知道在哪裏IM在減速會wrong.the系統輸出未在此得到printed.any幫助?

回答

0

可能的原因:您並沒有從映射器輸出任何東西,以便減速器首先運行。嘗試使用映射器中的outputCollector.collect(key, value);爲減速器寫入實際運行的內容。

+0

嗨,我已按照您告訴我的方式,我的減速器正在執行,現在我必須在另一個mapper中使用此減速器的輸出.i在減速器後添加了另一個映射器,但減速器輸出爲沒有來到下一個映射器,而是從文件中獲取值。對此的任何建議? – user1585111

+0

因爲,你原來的問題沒有,我要求你提出一個新問題,說明你使用map-reduce-map鏈以及你試過的代碼得到了什麼問題。如果您認爲它解決了您的問題,請將此問題標記爲已解決。謝謝! –