我在java中有wriiten map reduce程序
public class myproject {
public static class Map extends Mapper<LongWritable, Text, Text, Text> {
private final static IntWritable one = new IntWritable(1);
private Text word = new Text();
public void map(LongWritable key, Text value, OutputCollector<Text, Text> output, Reporter reporter) throws IOException {
String line = value.toString();
/*
MY CODE
*/
output.collect(new Text(string1),new Text(string2));
}
}
public class Reduce extends Reducer<Text, Text, Text, IntWritable> {
public void reduce(Text key, Iterator<Text> values, OutputCollector<Text, IntWritable> output, Reporter reporter) throws IOException {
while (values.hasNext()) {
/*
MY CODE
*/
values.next();
}
output.collect(key, new IntWritable(val));
}
}
public static void main(String[] args) throws Exception {
JobConf conf = new JobConf(myproject.class);
conf.setJobName("myprojectwork");
conf.setOutputKeyClass(Text.class);
conf.setOutputValueClass(IntWritable.class);
conf.setMapOutputKeyClass(Text.class);
conf.setMapOutputValueClass(Text.class);
conf.setMapperClass(Map.class);
conf.setCombinerClass(Reduce.class);
conf.setReducerClass(Reduce.class);
conf.setInputFormat(TextInputFormat.class);
conf.setOutputFormat(TextOutputFormat.class);
FileInputFormat.setInputPaths(conf, new Path(args[0]));
FileOutputFormat.setOutputPath(conf, new Path(args[1]));
JobClient.runJob(conf);
现在当我尝试使用
运行它时hadoop jar /usr/local/hadoop/share/hadoop/mapreduce/showstatus.jar myproject projectfolder/input projectfolder/output
它只显示此然后退出
WARN util.NativeCodeLoader: Unable to load native-hadoop library for your platform... using builtin-java classes where applicable
当我尝试列出projectfolder / output文件夹时 它没有显示这样的文件/目录
wordcount问题工作绝对正常,但我的程序无效
有什么我错过的
我是否必须编辑hadoop目录中的任何.xml文件或类似内容?