系统吧 专业的电脑操作系统,支持重装各种原版系统xp/win7/win8/win10 这个系统怎么样?试试系统吧系统,体验办公系统畅快愉悦感。 各种电脑系统安装过程一样,神一般的畅快!
-->
当前位置:主页 > 电脑技术 >

hive权限用Sentry详细使用测试文档

作者:谢昕芙 分类:电脑技术 发布时间:2021-07-10 16:56:00

背景:1、Apache Sentry是Cloudera公司发布的一个Hadoop开源组件,它提供了细粒度级、基于角色的授权以及多租户的管理模式,2、Sentry当前可以和Hive/Hcatalog、Apache Solr 和Cloudera Impala集成, 为这些组件提供权限管理服务。 3、基于角色的管理(role-based acess control)通过创建角色,将每个组件的权限授予给此角色,然后在用户(组)中添加此角色,用户便具备此角色访问组件的权限,4、使用sentry对hive进行权限管理时,这里的组件可以是整个server,也可以是单个d...

背景:1、Apache Sentry是Cloudera公司发布的一个Hadoop开源组件,它提供了细粒度级、基于角色的授权以及多租户的管理模式,2、Sentry当前可以和Hive/Hcatalog、Apache Solr 和Cloudera Impala集成, 为这些组件提供权限管理服务。 3、基于角色的管理(role-based acess control)通过创建角色,将每个组件的权限授予给此角色,然后在用户(组)中添加此角色,用户便具备此角色访问组件的权限,4、使用sentry对hive进行权限管理时,这里的组件可以是整个server,也可以是单个db,或者单张table.

测试如下:1.1 查看全部数据库beeline -u "jdbc:hive2://uhadoop-4wvgxxla-master2:10000" -n hive -e "show databases;"

我尝试的先创建一个库 报错如下:[hadoop@uhadoop-4wvgxxla-master2 ~]$ beeline -u "jdbc:hive2://uhadoop-4wvgxxla-master2:10000" -n hive -e "create database test;"Transaction isolation: TRANSACTION_REPEATABLE_READError: Error while compiling statement: FAILED: SemanticException No valid privilegesUser hive does not have privileges for CREATEDATABASE 用户配置单元没有CREATEDATABASE的特权 The required privileges: Server=uhadoop-4wvgxxla-master1->action=create->grantOption=false; (state=42000,code=40000)Closing: 0: jdbc:hive2://uhadoop-4wvgxxla-master2:10000

1.2 查看全部角色beeline -u "jdbc:hive2://uhadoop-4wvgxxla-master2:10000" -n hive -e "show roles;"Transaction isolation: TRANSACTION_REPEATABLE_READ+-------+| role |+-------++-------+No rows selected (1.151 seconds)Beeline version 2.3.3 by Apache HiveClosing: 0: jdbc:hive2://uhadoop-4wvgxxla-master2:10000// 用户角色为空

1.3 查看当前角色beeline -u "jdbc:hive2://uhadoop-4wvgxxla-master2:10000" -n hive -e "show current roles;"Driver: Hive JDBC (version 2.3.3)Transaction isolation: TRANSACTION_REPEATABLE_READ+-------+| role |+-------++-------+No rows selected (0.446 seconds)Beeline version 2.3.3 by Apache HiveClosing: 0: jdbc:hive2://uhadoop-4wvgxxla-master2:10000// 显示当前没有任何的角色

1.4 查看当前用户beeline -u "jdbc:hive2://uhadoop-4wvgxxla-master2:10000" -n hive -e "select current_user();"Driver: Hive JDBC (version 2.3.3)Transaction isolation: TRANSACTION_REPEATABLE_READ+-------+| _c0 |+-------+| hive |+-------+1 row selected (1.124 seconds)Beeline version 2.3.3 by Apache HiveClosing: 0: jdbc:hive2://uhadoop-4wvgxxla-master2:10000

// 当前操作hiveserver2的用户是hive

    hive用户授予管理员权限2.1 创建管理员角色adminbeeline -u "jdbc:hive2://uhadoop-4wvgxxla-master2:10000" -n hive -e "CREATE ROLE admin;"

2.2 为admin角色授予全部server权限beeline -u "jdbc:hive2://uhadoop-4wvgxxla-master2:10000" -n hive // 进入到hiveserver2的内部之后执行如下:0: jdbc:hive2://uhadoop-4wvgxxla-master2:1000> grant all on server uhadoop-4wvgxxla-master1 to role admin;No rows affected (0.491 seconds)

2.3 为hive用户赋予admin角色//经过这一步,hive用户已经可以作为管理员用户执行全部数据和权限操作。beeline -u "jdbc:hive2://uhadoop-4wvgxxla-master2:10000" -n hive -e "GRANT ROLE admin TO GROUP hive;"

create table student(Sno char(9) COMMENT '用户ID',Sname char(20) ,Ssex char(2),Sage int,Sdept char(20));

insert into student values(200215121,'李勇','男',20,'CS');

没有出现中文乱码的问题,请测验证方式需要:show create table xxx;desc xxx;desc formatted xxx;查看3种方式是不是都没有中文乱码的问题

    创建测试数据库(使用hive用户创建)3.1 创建测试db1,db2//使用管理员用户登陆,创建db1,db2两个数据库。beeline -u "jdbc:hive2://uhadoop-4wvgxxla-master2:10000" -n hive -e "create database db1;create database db2;"

// 创建测试表,并插入数据

beeline -u "jdbc:hive2://uhadoop-4wvgxxla-master2:10000" -n hive -e "create table db1.t1(id string);"

beeline -u "jdbc:hive2://uhadoop-4wvgxxla-master2:10000" -n hive -e "insert into db1.t1 values ('t1_001'),('t1_002');"

xp 更多>>
win7 更多>>
win8 更多>>
win10 更多>>
U盘 更多>>
电脑技术 更多>>
网站地图 | 豫ICP备2021035069号-4 | 友情链接qq:191064436
系统吧

版权所有 © 2012-2023 系统吧 免责声明:本站资源均收集于互联网,其著作权归原作者所有,如果有侵犯您权利的资源,请来信告知,我们将及时删除相应资源。