从远程系统提交mapreduce作业时出现异常
13/10/28 18:49:52错误security.usergroupinformation:priviledgedactionexception as:rootcause:org.apache.hadoop.mapred.invalidinputexception:输入路径不存在:file:/f:/workspaces/test/hadoop/test
我的hadoop和mapreduce环境是在linux机器上配置的。我从本地windows pc提交wordcount作业,如下所示:
public static void main(String[] args) throws Exception {
UserGroupInformation ugi = UserGroupInformation.createRemoteUser("root");
try {
ugi.doAs(new PrivilegedExceptionAction<Void>() {
public Void run() throws Exception {
JobConf conf = new JobConf(MapReduce.class);
conf.set("mapred.job.name", "MyApp");
conf.set("mapred.job.tracker", "192.168.1.149:9001");
conf.set("fs.default.name","hdfs://192.168.1.149:9000");
conf.set("hadoop.job.ugi", "root");
conf.setOutputKeyClass(Text.class);
conf.setOutputValueClass(IntWritable.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("test"));
FileOutputFormat.setOutputPath(conf, new Path("test"));
JobClient.runJob(conf);
return null;
}
});
} catch (Exception e) {
e.printStackTrace();
}
}
其中192.168.1.149是hadoop配置的linux pc。我在那里启动了hadoop、mapreduce服务。测试目录也是用同样的javaapi创建的,它工作正常。但mapreduce不是。
请帮忙
1条答案
按热度按时间jutyujz01#
实际上是我的配置错误:
我错过了mapred-site.xml中的mapred.local.dir属性