hive使用时的用户权限问题

0: jdbc:hive2://node1:10000> create role root;

Error: Error while processing statement: FAILED: Execution Error, return code 1 from org.apache.hadoop.hive.ql.exec.DDLTask. Current user : ljr is not allowed to add roles. User has to belong to ADMIN role and have it as current role, for this action. (state=08S01,code=1)

对于由于用户权限引起的报错,我们知道只要对用户进行授予相关的权限就可以解决问题,但是最令人疑惑的是,这个授权的boss是谁?我们可以从报错内容看出授权的必须是belong to ADMIN role and have it as current role(属于超级管理员的角色,并且是当前的角色),下面讨论怎么进行设置;

解决办法:

1、在hive-site.xml中指定超级管理员:

vim $HIVE_HOME/conf/hive-site.xml

<!-- 指定超级管理员 -->

<property>

  <name>hive.users.in.admin.role</name>

  <value>ljr</value>

</property>

2、通过beeline以ljr用户进入hive 

beeline -u jdbc:hive2://node1:10000 -n ljr

分别执行以下操作

set hive.users.in.admin.role;

set role admin;

create role root;

到此可以发现用户ljr已经有了创建角色的权限;事实上ljr已经拥有了hive超级管理员的所有权限

比如:未进行set role admin;时ljr是无权将test库的权限开放给其他用户的

0: jdbc:hive2://node1:10000> grant all on database test to user root;

Error: Error while processing statement: FAILED: Execution Error, return code 1 from org.apache.hadoop.hive.ql.exec.DDLTask. Permission denied: Principal [name=ljr, type=USER] does not have following privileges for operation GRANT_PRIVILEGE [[SELECT with grant, INSERT with grant, UPDATE with grant, DELETE with grant] on Object [type=DATABASE, name=test]] (state=08S01,code=1)

但进行以上操作后可以发现ljr可以对test库进行授权了

0: jdbc:hive2://node1:10000> grant all on database test to user root;

0: jdbc:hive2://node1:10000> show grant user root;

  • 3
    点赞
  • 6
    收藏
    觉得还不错? 一键收藏
  • 1
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值