hive 权限笔记

简介:

启动权限,hive默认是禁止的。


Configuration

For Hive 0.13.x

Set the following in hive-site.xml:

  • hive.server2.enable.doAs to false.

  • hive.users.in.admin.role to the list of comma-separated users who need to be added to admin role. Note that a user who belongs to the admin role needs to run the "set role" command before getting the privileges of the admin role, as this role is not in current roles by default.

Start HiveServer2 with the following additional command-line options:

  • -hiveconf hive.security.authorization.manager=org.apache.hadoop.hive.ql.security.authorization.plugin.sqlstd.SQLStdHiveAuthorizerFactory

  • -hiveconf hive.security.authorization.enabled=true

  • -hiveconf hive.security.authenticator.manager=org.apache.hadoop.hive.ql.security.SessionStateUserAuthenticator

  • -hiveconf hive.metastore.uris=' '

For Hive 0.14 and Newer

Set the following in hive-site.xml:

  • hive.server2.enable.doAs to false.

  • hive.users.in.admin.role to the list of comma-separated users who need to be added to admin role. Note that a user who belongs to the admin role needs to run the "set role" command before getting the privileges of the admin role, as this role is not in current roles by default.

  • Add org.apache.hadoop.hive.ql.security.authorization.MetaStoreAuthzAPIAuthorizerEmbedOnly to hive.security.metastore.authorization.manager. (It takes a comma separated list, so you can add it along with StorageBasedAuthorization parameter, if you want to enable that as well).
    This setting disallows any of the authorization api calls to be invoked in a remote metastore. HiveServer2 can be configured to use embedded metastore, and that will allow it to invoke metastore authorization api. Hive cli and any other remote metastore users would be denied authorization when they try to make authorization api calls. This restricts the authorization api to privileged HiveServer2 process. You should also ensure that the metastore rdbms access is restricted to the metastore server and hiverserver2.

  • hive.security.authorization.manager to org.apache.hadoop.hive.ql.security.authorization.plugin.sqlstd.SQLStdConfOnlyAuthorizerFactory. This will ensure that any table or views created by hive-cli have default privileges granted for the owner.

Set the following in hiveserver2-site.xml:

  • -hiveconf hive.security.authorization.manager=org.apache.hadoop.hive.ql.security.authorization.plugin.sqlstd.SQLStdHiveAuthorizerFactory

  • -hiveconf hive.security.authorization.enabled=true

  • -hiveconf hive.security.authenticator.manager=org.apache.hadoop.hive.ql.security.SessionStateUserAuthenticator

  • -hiveconf hive.metastore.uris=' '


角色管理:


说明:默认hive有public和admin角色,hive.users.in.admin.role 中指定的用户为admin角色,多个用户以逗号分隔

1、SET ROLE (role_name|ALL|NONE);

一个用户可以有多个用户组,SET ROLE命令会把当前用户切换到指定的角色组。










本文转自 yntmdr 51CTO博客,原文链接:http://blog.51cto.com/yntmdr/1749839,如需转载请自行联系原作者
目录
相关文章
|
SQL 存储 大数据
大数据开发笔记(四):Hive分区详解
在Hive Select查询中一般会扫描整个表内容,会消耗很多时间做没必要的工作。有时候只需要扫描表中关心的一部分数据,因此建表时引入了partition概念。
135 0
大数据开发笔记(四):Hive分区详解
|
SQL 缓存 负载均衡
|
SQL 存储 分布式计算
大数据开发笔记(四):Hive数据仓库
Hive主要解决海量结构化日志的数据统计分析,它是hadoop上的一种数据仓库工具,可以将结构化的数据文件映射成一张表,并提供类似于SQL的查询方式,本质上来说是将Hive转化成MR程序。
125 0
大数据开发笔记(四):Hive数据仓库
|
存储 SQL 数据库
Hive笔记
此文是学习《Hive编程指南》时所作的笔记,用于加深理解。
2416 0