Exception in thread "main" org.apache.hadoop.security.AccessControlException: Permission d

Posted 努力就是魅力

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了Exception in thread "main" org.apache.hadoop.security.AccessControlException: Permission d相关的知识,希望对你有一定的参考价值。

在window上编程提示没有写Hadoop的权限

 

Exception in thread "main" org.apache.hadoop.security.AccessControlException: Permission denied: user=Mypc, access=WRITE, inode="/":fan:supergroup:drwxr-xr-x

 

          曾经踩过的坑: 保存结果到hdfs上没有写的权限
* 通过修改权限将文件写入到指定的目录下
*
* $HADOOP_HOME/bin/hdfs dfs -mkdir /output
* $HADOOP_HOME/bin/hdfs dfs -chmod 777 /output


使用spark读取hdfs上的文件,进行wordcount 然后将结果保存到hdfs上。
object HdfsFileWordCount {
def main(args: Array[String]): Unit = {

val conf = new SparkConf().setMaster("local[*]").setAppName("hdfs file word count")
val sc = new SparkContext(conf)

val wc = sc.textFile("hdfs://master:8020/data/student.txt",1).flatMap(_.split(" "))
.filter(_.nonEmpty)
.map((_,1))
// .filter(_._2 > 1)
.reduceByKey(_+_)
.persist(StorageLevel.MEMORY_ONLY)
wc.foreach(println)

wc.saveAsTextFile("hdfs://master:8020/output/res1")

sc.stop()
}
}

























以上是关于Exception in thread "main" org.apache.hadoop.security.AccessControlException: Permission d的主要内容,如果未能解决你的问题,请参考以下文章

Exception in thread "main" java.lang.UnsupportedClassVersionError

Exception in thread "main" java.util.InputMismatchException

Exception in thread "main" java.lang.ClassCastException

Exception in thread "main" java.lang.UnsatisfiedLinkError:

Exception in thread "main" java.lang.ArrayIndexOutOfBoundsException: 1

Exception in thread "main" java.lang.NullPointerException