Configuring Permissions for Hive Tables, Columns, or Databases

Scenario

You can configure related permissions if you need to access tables or databases created by other users. Hive supports column-based permission control. If a user needs to access some columns in tables created by other users, the user must be granted the permission for columns. The following describes how to grant table, column, and database permissions to users by using the role management function of MRS Manager.

  • You can configure permissions for Hive tables, columns, or databases only in security mode.
  • MRS 3.x or later supports Ranger. If the current component uses Ranger for permission control, you need to configure permission management policies based on Ranger. For details, see Adding a Ranger Access Permission Policy for Hive.

Prerequisites

Procedure

In role management, the procedure for granting a role the permission of querying, inserting, and deleting Hive external table data is the same. After the metadata permission is granted, the HDFS permission is automatically granted.

In role management, after the metadata permission is granted, the HDFS permission is automatically granted. Therefore, after the column permission is granted, the HDFS ACL permission for all files of the table is automatically granted.

  • Any permission for a table in the database is automatically associated with the HDFS permission for the database directory to facilitate permission management. When any permission for a table is canceled, the system does not automatically cancel the HDFS permission for the database directory to ensure performance. In this case, users can only log in to the database and view table names.
  • When the query permission on a database is added to or deleted from a role, the query permission on tables in the database is automatically added to or deleted from the role.

Concepts

Table 1 Scenarios of using Hive tables, columns, or databases

Scenario

Required Permission

DESCRIBE TABLE

SELECT

SHOW PARTITIONS

SELECT

ANALYZE TABLE

SELECT and INSERT

SHOW COLUMNS

SELECT

SHOW TABLE STATUS

SELECT

SHOW TABLE PROPERTIES

SELECT

SELECT

SELECT

EXPLAIN

SELECT

CREATE VIEW

SELECT, Grant Of Select, and CREATE

SHOW CREATE TABLE

SELECT and Grant Of Select

CREATE TABLE

CREATE

ALTER TABLE ADD PARTITION

INSERT

INSERT

INSERT

INSERT OVERWRITE

INSERT and DELETE

LOAD

INSERT and DELETE

ALTER TABLE DROP PARTITION

DELETE

CREATE FUNCTION

Hive Admin Privilege

DROP FUNCTION

Hive Admin Privilege

ALTER DATABASE

Hive Admin Privilege