您的位置:首页 > 大数据 > Hadoop

chmod: changing permissions of ‘/user/hive/warehouse‘: Permission denied. user=hdfs is not the owner

2020-08-06 15:44 363 查看

安装hive后发现无法创建表和写入

在执行Hadoop的创建目录、写数据等情况,可能会出现该异常,而在读文件的时候却不会报错,这主要是由于系统的用户名不同导致的,由于我们进行实际开发的时候都是用Windows操作系统,而编译后的JAVA程序是部署在Linux上的。而Windows的用户名一般都是自定义的或者是administrator,Linux的用户名是root,对于Hadoop的部署,也有可能是hadoop用户名。
由于,Hadoop的权限验证是依靠Linux系统的,而用户名不一致,会报错,这个错误很经典,异常名是

解决办法

<property>
<name>dfs.permissions.enabled</name>
<value>true</value>
<description>
If "true", enable permission checking in HDFS.
If "false", permission checking is turned off,
but all other behavior is unchanged.
Switching from one parameter value to the other does not change the mode,
owner or group of files or directories.
</description>
</property>

将这里面的value改为false,写到hdfs-site.xml中即可.
然后,重启namenode:

hadoop-daemon.sh stop namenode
hadoop-daemon.sh start namenode

然后直接就ok了 重启hive 直接创建表ok

hive> create table t1(id string);
OK
Time taken: 4.583 seconds
hive> show tables;
OK
t1
Time taken: 0.111 seconds, Fetched: 1 row(s)
hive>
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: 
相关文章推荐