集群中使用root用户执行hdfs dfs、hive等命令时遇到Exception in thread "main" java.lang.RuntimeException: org.apache.hadoop.security.AccessControlException:
Permission denied: user=root, access=WRITE, inode="/user":hdfs:hdfs:drwxr-xr-x报错信息
个人理解:在执行命令时,会将一些中间结果或者临时文件写入到 /user/用户名 所在hdfs目录,所以执行用户需要有写权限
而一般hadoop集群初次搭建好后,没有root用户,通过以下方式创建用户
su - hdfs
hdfs dfs -mkdir /user/root
hdfs dfs -chown root:root /user/root
其他方式:使用hdfs用户操作