场景还原:
最近使用hue对hive进行操作,虽然好用,但是也遇见很多问题,执行一些函数时就会报错,报错内容如下:
Error while processing statement: FAILED: Execution Error, return code 1 from org.apache.hadoop.hive.ql.exec.mr.MapRedTask. The ownership on the staging directory /user/admin/.staging is not as expected. It is owned by root. The directory must be owned by the submitter admin or admin or hive or hive
看了一下内容,问题就是hue的用户并不是hive上的用户,所以不可进行操作,对此解决办吧如下。
解决办法:
对HUE的用户进行授权,也就是把hue的账户分配到CDH下的用户组中,步骤如下:
1、打开HUE的web端,右上角点开用户,点击【管理用户】
2、对默认用户组进行赋权
3、将HUE用户放入到我们刚才更新的用户组中
然后我没成功!!!错误依然存在,于是我仔细阅读了ERROR,
/user/admin/.staging is not as expected
,分析了一下,发现HDFS上/user/admin/
有一个.staging
的文件,其用户是root
,其余的都是admin
。刷新一下HUE web,之后就没问题了。
问题总结
回忆了一下过程,问题原因应该是我当时在使用hue的时候自己去创建了一个账户叫做root,我们每次进行操作的时候,列如函数操作等,会将这些操作记录到HDFS下的/user/下对应的账户中,
而我的HUE的root账户应该是设置错了,设置在了admin下,导致在admin下出现了root用户才能使用的文件,所以权限不通,因为本次操作我是用的是admin,故会报以上的错误。将HDFS错的文件删除就没有问题了。
不过上面的权限步骤是正确的哈!
VX :WL1179952622 ,一起学习大数据,备注一下哪来的哈!