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

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

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

beeline -u "jdbc:hive2://uhadoop-4wvgxxla-master2:10000" -n hive -e "create table db2.t2(id string);" beeline -u "jdbc:hive2://uhadoop-4wvgxxla-master2:10000" -n hive -e "insert into db2.t2 values ('t...

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

beeline -u "jdbc:hive2://uhadoop-4wvgxxla-master2:10000" -n hive -e "insert into db2.t2 values ('t2_001'),('t2_002');"

0: jdbc:hive2://uhadoop-4wvgxxla-master2:1000> use db1;No rows affected (0.173 seconds)0: jdbc:hive2://uhadoop-4wvgxxla-master2:1000> show tables;+-----------+| tab_name |+-----------+| t1 |+-----------+1 row selected (0.208 seconds)0: jdbc:hive2://uhadoop-4wvgxxla-master2:1000> select * from t1;+---------+| t1.id |+---------+| t1_001 || t1_002 |+---------+2 rows selected (0.294 seconds)

0: jdbc:hive2://uhadoop-4wvgxxla-master2:1000> select * from db2.t2;+---------+| t2.id |+---------+| t2_001 || t2_002 |+---------+2 rows selected (0.304 seconds)

3.2 master1,master2节点上创建linux测试用户user1, user2useradd -M -s /sbin/nologin user1

useradd -M -s /sbin/nologin user2

cat /etc/passwd user1:x:1004:1005::/home/user1:/sbin/nologinuser2:x:1005:1006::/home/user2:/sbin/nologin

3.3 hive中创建两个角色,分别授予不同的角色权限//创建角色role1, 授予其对db1的管理权限beeline -u "jdbc:hive2://uhadoop-4wvgxxla-master2:10000" -n hive -e "CREATE ROLE role1;"beeline -u "jdbc:hive2://uhadoop-4wvgxxla-master2:10000" -n hive -e "grant all on database db1 to role role1 with grant option;"

//创建角色role2, 授予其对db2的管理权限beeline -u "jdbc:hive2://uhadoop-4wvgxxla-master2:10000" -n hive -e "CREATE ROLE role2;"beeline -u "jdbc:hive2://uhadoop-4wvgxxla-master2:10000" -n hive -e "grant all on database db2 to role role2 with grant option;"

// show grant role role1; (查看role1角色的权限列表)// show grant role role2; (查看role2角色的权限列表)

0: jdbc:hive2://uhadoop-4wvgxxla-master2:1000> show grant role role1;+-----------+--------+------------+---------+-----------------+-----------------+------------+---------------+----------------+----------+| database | table | partition | column | principal_name | principal_type | privilege | grant_option | grant_time | grantor |+-----------+--------+------------+---------+-----------------+-----------------+------------+---------------+----------------+----------+| db1 | | | | role1 | ROLE | | true | 1583739035000 | -- |+-----------+--------+------------+---------+-----------------+-----------------+------------+---------------+----------------+----------+1 row selected (0.215 seconds)0: jdbc:hive2://uhadoop-4wvgxxla-master2:1000> show grant role role2;+-----------+--------+------------+---------+-----------------+-----------------+------------+---------------+----------------+----------+| database | table | partition | column | principal_name | principal_type | privilege | grant_option | grant_time | grantor |+-----------+--------+------------+---------+-----------------+-----------------+------------+---------------+----------------+----------+| db2 | | | | role2 | ROLE | | true | 1583739057000 | -- |+-----------+--------+------------+---------+-----------------+-----------------+------------+---------------+----------------+----------+1 row selected (0.119 seconds)0: jdbc:hive2://uhadoop-4wvgxxla-master2:1000> show grant role admin;+-----------+--------+------------+---------+-----------------+-----------------+------------+---------------+----------------+----------+| database | table | partition | column | principal_name | principal_type | privilege | grant_option | grant_time | grantor |+-----------+--------+------------+---------+-----------------+-----------------+------------+---------------+----------------+----------+| | | | | admin | ROLE | | false | 1583737318000 | -- |+-----------+--------+------------+---------+-----------------+-----------------+------------+---------------+----------------+----------+1 row selected (0.131 seconds)

3.4 管理员用户登陆hive,为两个用户赋予不同的角色beeline -u "jdbc:hive2://uhadoop-4wvgxxla-master2:10000" -n hive -e "GRANT ROLE role1 TO GROUP user1;"

beeline -u "jdbc:hive2://uhadoop-4wvgxxla-master2:10000" -n hive -e "GRANT ROLE role2 TO GROUP user2;"

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

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