背景
在开启sentry后,hdfs的/user/hive/warehouse目录被sentry进行了纳管,无法使用hdfs 用户设置对应目录的访问权限,如下载和查看目录的内容。一些其他应用也需要使用此目录,如spark 等
配置
在开启sentry 后, 选择hdfs——》配置——》搜索acl
用来开启和sentry权限关系的映射
现在在sentry中进行授权后,权限会映射为目录的acl权限。
理解
Sentry权限和hdfs 权限的映射关系
Sentry权限 | hdfs权限 |
---|---|
select | read(r_x) |
insert | write(w_x) |
all | read and write and execute(rwx) |
beeline -u “jdbc:hive2://cdh01.yifan.com:10000/;principal=hive/cdh01.yifan.com@FAYSON.COM” #beeline连接串
create role xxx_role ;创建role
grant all on database xxx to role xxx_role; #将库的all权限授予给xxx_role
grant role xxx_role to group g_xxx_user; #将xxx_role和用户组g_xxx_user进行关联
会将all权限映射到/user/hive/warehouse/xxx.db目录及子目录,acl权限为group:xxx_user:rwx。如果为select,则为group:xxx_user:r_x
grant all on uri “hdfs://yifannamservice1/user/hive/warehouse/xxx.db” to role xxx_role; #授予uri权限
这个会将uri的all 权限映射为/user/hive/warehouse/xxx.db目录的acl权限group:xxx_user:rwx(子目录不会继承)