我试图通过查询将数据从hdfs目录中的一个文件插入到hive表中:
$ jdbc:hive2://localhost:10000> LOAD DATA INPATH '/user/xyz/stdfiles/testtbl.txt' OVERWRITE INTO TABLE testdb.testtbl;但是查询失败,结果是:
错误:编译语句时出错:失败:获得hdfs://localhost:9000/user/xyz/stdfiles/testtbl.txt: null权限的HiveAuthzPluginException错误(state=42000,code=40000)
我尝试通过以下命令授予权限,该命令没有出现错误:
$ hdfs dfs -chown -R stdfiles /user/xyz/stdfiles
$ hdfs dfs -chmod -R 777 /user/xyz/stdfiles/testtbl.txt检查:
$ hdfs dfs -ls /user/xyz/stdfiles
19/05/22 09:15:13 WARN util.NativeCodeLoader: Unable to load native-hadoop library for your platform... using builtin-java classes where applicable
Found 1 items
-rwxrwxrwx 1 stdfiles supergroup 6 2019-05-22 08:45 /user/xyz/stdfiles/testtbl.txt成功地插入数据是通过期望的输出。
发布于 2019-05-22 17:44:00
在hadoop配置文件core-site.xml中添加以下属性:)
<property>
<name>hadoop.proxyuser.niazullah.hosts</name>
<value>*</value>
</property>
<property>
<name>hadoop.proxyuser.niazullah.groups</name>
<value>*</value>
</property>还检查用户访问hdfs:
$ hdfs dfs -ls /user输出:
drwxr-xr-x - main supergroup 0 2019-05-22 13:22 /user/test其中"main“是用户更改的,它做的是单元用户。
https://stackoverflow.com/questions/56257808
复制相似问题