在学习过程中使用DataGrap执行Hive语句,进行数据的查询使用select时出现报错。
[08S01][1] Error while processing statement: FAILED: Execution Error, return code 1 from org.apache.hadoop.hive.ql.exec.mr.MapRedTask. User: xxx is not allowed to impersonate xxx
这个错误提示表明用户"xxx"没有被允许模拟用户"xxx"
首先检查Hadoop配置文件中的core-site.xml
和hdfs-site.xml
文件,确保用户是否被授权模拟其他用户(xxx)的权限
<property>
<name>hadoop.proxyuser.hadoop.hosts</name>
<value>*</value>
</property>
<property>
<name>hadoop.proxyuser.hadoop.groups</name>
<value>*</value>
</property>
检查后发现core-site.xml
和hdfs-site.xml
文件都没有问题
后面发现是hive-site.xml文件出现问题,h文件中的ive.server2.enable.doAs被配置成了true
在hive目录下的conf文件下的hive-site.xml文件,添加配置
<property>
<name>hive.server2.enable.doAs</name>
<value>false</value>
</property>
修改后成功解决问题
当hive.server2.enable.doAs设置成false则,yarn作业获取到的hiveserver2用户都为hive用户。
设置成true则为实际的用户名