HDFS权限被拒绝

时间:2014-05-23 09:48:37

标签: java hadoop mapreduce permission-denied

我正在尝试从java启动MapReduce作业。但是当我尝试提交作业时,我得到Permission Denied例外。我可以从命令行运行hdfs dfs -ls /而不会出现任何错误。但它不适用于我的java程序。

这是我的代码

public static void main(String[] args) {
    Configuration conf=new Configuration();

    conf.set("mapreduce.map.class","org.apache.hadoop.conf.TestMapper");
    conf.set("mapreduce.reduce.class","org.apache.hadoop.conf.TestReducer");

    conf.set("mapreduce.framework.name","yarn");

    conf.set("hadoop.security.group.mapping","org.apache.hadoop.security.ShellBasedUnixGroupsMapping");

    conf.set("fs.default.name","hdfs://master:9000");

    conf.set("dfs.permission","false");

    conf.set("yarn.nodemanager.aux-services","mapreduce_shuffle");
    conf.set("yarn.resourcemanager.resource-tracker.address","master:8025");
    conf.set("yarn.resourcemanager.scheduler.address","master:8030");
    conf.set("yarn.resourcemanager.address","master:8040");
    conf.set("yarn.nodemanager.localizer.address","master:8060");
    Job job=null;
    try {
        job = Job.getInstance(conf, "Test Map Reduce");

        job.setJarByClass(RunJob.class);

        job.setOutputKeyClass(LongWritable.class);
        job.setOutputValueClass(Text.class);

        job.setInputFormatClass(TextInputFormat.class);
        job.setOutputFormatClass(TextOutputFormat.class);

        TextInputFormat.setInputPaths(job, new Path("/input.txt"));
        TextOutputFormat.setOutputPath(job, new Path("/output"));

        job.submit();

}

但我得到以下异常

org.apache.hadoop.security.AccessControlException: Permission denied: user=manthosh, access=EXECUTE, inode="/tmp":hduser:supergroup:drwxrwx---

解决方案here不起作用。

我错过了什么?

0 个答案:

没有答案