简体   繁体   English

Apache sentry - 获取已分配给给定数据库/表的哨兵组

[英]Apache sentry - Get sentry groups to which a given database/tables has been assigned to

我想为给定的数据库/表获取该数据库/表已在哨兵中被授予访问权限的组列表。

There does not appear to be a Sentry SHOW command for this purpose in the documentation . 文档中似乎没有用于此目的的 Sentry SHOW 命令。

This blog post suggests that you can instead query the Sentry database directly (assuming you are using the Sentry service, not policy files).这篇博文建议您可以改为直接查询 Sentry 数据库(假设您使用的是 Sentry 服务,而不是策略文件)。

However, at present there is no command to show the group to role mapping.但是,目前没有显示组到角色映射的命令。 The only way to do this is by connecting to the Sentry database and deriving this information from the tables in the database.做到这一点的唯一方法是连接到 Sentry 数据库并从数据库中的表中获取此信息。

If you're using CDH you can determine which node in the cluster is running the Sentry database using Cloudera Manager, navigating to Clusters > Sentry, then clicking Sentry Server and then Configuration.如果您使用 CDH,您可以使用 Cloudera Manager 确定集群中的哪个节点正在运行 Sentry 数据库,导航到集群 > Sentry,然后依次单击 Sentry 服务器和配置。 Here you will find the type of database being used (eg MySQL, PostgreSQL, Oracle), the server the databases is running on, it's port, the database name and user.在这里您将找到正在使用的数据库类型(例如 MySQL、PostgreSQL、Oracle)、运行数据库的服务器、端口、数据库名称和用户。

You will need the Sentry database password - the blog post gives a suggestion for retrieving it if you do not know it.您将需要 Sentry 数据库密码 - 如果您不知道,博客文章提供了检索它的建议。

An example query for a PostgreSQL database is given:给出了 PostgreSQL 数据库的示例查询:

SELECT "SENTRY_ROLE"."ROLE_NAME","SENTRY_GROUP"."GROUP_NAME"
FROM "SENTRY_ROLE_GROUP_MAP"
JOIN "SENTRY_ROLE" ON "SENTRY_ROLE"."ROLE_ID"="SENTRY_ROLE_GROUP_MAP"."ROLE_ID"
JOIN "SENTRY_GROUP" ON "SENTRY_GROUP"."GROUP_ID"="SENTRY_ROLE_GROUP_MAP"."GROUP_ID";

However, I have not tried this query myself.但是,我自己还没有尝试过这个查询。

This should work for MySQL:这应该适用于 MySQL:

SELECT R.ROLE_NAME, G.GROUP_NAME
FROM SENTRY_ROLE_GROUP_MAP RGM
JOIN SENTRY_ROLE R ON R.ROLE_ID=RGM.ROLE_ID
JOIN SENTRY_GROUP G ON G.GROUP_ID=RGM.GROUP_ID;

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM