遇到hive权限控制无效问题,求助~
操作步骤如下:
1. 在hive-site.xml文件中配置参数开启权限认证
<property>
<name>hive.security.authorization.enabled</name>
<value>true</value>
<description>enableor disable the hive clientauthorization</description>
</property>
<property>
<name>hive.security.authorization.createtable.owner.grants</name>
<value>ALL</value>
<description>theprivileges automatically granted to the ownerwhenever a table gets created. Anexample like "select,drop" willgrant select and drop privilege to theowner of the table</description>
</property>
hive.security.authorization.enabled参数是开启权限验证,默认为false。
hive.security.authorization.createtable.owner.grants参数是指表的创建者对表拥有所有权限。
qcbb001 发表于 2016-7-5 13:49
楼主可以尝试下面方法
[mw_shl_code=bash,true]hive> set hive.security.authorization.enabled=true;
...
已尝试过,不知为何,可正常创建
hive> set hive.security.authorization.enabled=true;
hive> CREATE TABLE authorization_test (key int, value string);
OK
Time taken: 3.017 seconds
hive> show tables;
OK
authorization_test
重置配置后:hive> set hive.metastore.authorization.storage.checks=true;
hive> set hive.security.authorization.enabled=true;
hive> show grant user hive on table authorization_test01;
OK
default authorization_test01 hive USER DELETE true 1467700837000 hive
default authorization_test01 hive USER INSERT true 1467700837000 hive
default authorization_test01 hive USER SELECT true 1467700837000 hive
default authorization_test01 hive USER UPDATE true 1467700837000 hive
Time taken: 0.335 seconds, Fetched: 4 row(s)
hive> revoke DELETE on table authorization_test01 from user hive;
OK
Time taken: 0.667 seconds
hive> revoke UPDATE on table authorization_test01 from user hive;
OK
Time taken: 0.544 seconds
hive> show grant user hive on table authorization_test01;
OK
default authorization_test01 hive USER INSERT true 1467700837000 hive
default authorization_test01 hive USER SELECT true 1467700837000 hive
Time taken: 0.797 seconds, Fetched: 2 row(s)
hive> DROP TABLE authorization_test01;
OK
Time taken: 1.629 seconds