Compute
Elastic Cloud Server
Huawei Cloud Flexus
Bare Metal Server
Auto Scaling
Image Management Service
Dedicated Host
FunctionGraph
Cloud Phone Host
Huawei Cloud EulerOS
Networking
Virtual Private Cloud
Elastic IP
Elastic Load Balance
NAT Gateway
Direct Connect
Virtual Private Network
VPC Endpoint
Cloud Connect
Enterprise Router
Enterprise Switch
Global Accelerator
Management & Governance
Cloud Eye
Identity and Access Management
Cloud Trace Service
Resource Formation Service
Tag Management Service
Log Tank Service
Config
OneAccess
Resource Access Manager
Simple Message Notification
Application Performance Management
Application Operations Management
Organizations
Optimization Advisor
IAM Identity Center
Cloud Operations Center
Resource Governance Center
Migration
Server Migration Service
Object Storage Migration Service
Cloud Data Migration
Migration Center
Cloud Ecosystem
KooGallery
Partner Center
User Support
My Account
Billing Center
Cost Center
Resource Center
Enterprise Management
Service Tickets
HUAWEI CLOUD (International) FAQs
ICP Filing
Support Plans
My Credentials
Customer Operation Capabilities
Partner Support Plans
Professional Services
Analytics
MapReduce Service
Data Lake Insight
CloudTable Service
Cloud Search Service
Data Lake Visualization
Data Ingestion Service
GaussDB(DWS)
DataArts Studio
Data Lake Factory
DataArts Lake Formation
IoT
IoT Device Access
Others
Product Pricing Details
System Permissions
Console Quick Start
Common FAQs
Instructions for Associating with a HUAWEI CLOUD Partner
Message Center
Security & Compliance
Security Technologies and Applications
Web Application Firewall
Host Security Service
Cloud Firewall
SecMaster
Anti-DDoS Service
Data Encryption Workshop
Database Security Service
Cloud Bastion Host
Data Security Center
Cloud Certificate Manager
Edge Security
Managed Threat Detection
Blockchain
Blockchain Service
Web3 Node Engine Service
Media Services
Media Processing Center
Video On Demand
Live
SparkRTC
MetaStudio
Storage
Object Storage Service
Elastic Volume Service
Cloud Backup and Recovery
Storage Disaster Recovery Service
Scalable File Service Turbo
Scalable File Service
Volume Backup Service
Cloud Server Backup Service
Data Express Service
Dedicated Distributed Storage Service
Containers
Cloud Container Engine
SoftWare Repository for Container
Application Service Mesh
Ubiquitous Cloud Native Service
Cloud Container Instance
Databases
Relational Database Service
Document Database Service
Data Admin Service
Data Replication Service
GeminiDB
GaussDB
Distributed Database Middleware
Database and Application Migration UGO
TaurusDB
Middleware
Distributed Cache Service
API Gateway
Distributed Message Service for Kafka
Distributed Message Service for RabbitMQ
Distributed Message Service for RocketMQ
Cloud Service Engine
Multi-Site High Availability Service
EventGrid
Dedicated Cloud
Dedicated Computing Cluster
Business Applications
Workspace
ROMA Connect
Message & SMS
Domain Name Service
Edge Data Center Management
Meeting
AI
Face Recognition Service
Graph Engine Service
Content Moderation
Image Recognition
Optical Character Recognition
ModelArts
ImageSearch
Conversational Bot Service
Speech Interaction Service
Huawei HiLens
Video Intelligent Analysis Service
Developer Tools
SDK Developer Guide
API Request Signing Guide
Terraform
Koo Command Line Interface
Content Delivery & Edge Computing
Content Delivery Network
Intelligent EdgeFabric
CloudPond
Intelligent EdgeCloud
Solutions
SAP Cloud
High Performance Computing
Developer Services
ServiceStage
CodeArts
CodeArts PerfTest
CodeArts Req
CodeArts Pipeline
CodeArts Build
CodeArts Deploy
CodeArts Artifact
CodeArts TestPlan
CodeArts Check
CodeArts Repo
Cloud Application Engine
MacroVerse aPaaS
KooMessage
KooPhone
KooDrive
On this page

Creating a Hive Role

Updated on 2022-12-14 GMT+08:00

Scenario

This section describes how to create and configure a Hive role on Manager as the system administrator. The Hive role can be granted the permissions of the Hive administrator and the permissions to operate Hive table data.

Creating a database with Hive requires users to join in the hive group, without granting a role. Users have all permissions on the databases or tables created by themselves in Hive or HDFS. They can create tables, select, delete, insert, or update data, and grant permissions to other users to allow them to access the tables and corresponding HDFS directories and files. The created databases or tables are saved in the /user/hive/warehouse directory of the HDFS by default.

NOTE:
  • A Hive role can be created only in security mode.
  • 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 for MRS 3.x or later that supports Ranger.

Prerequisites

  • The system administrator has understood the service requirements.
  • Log in to FusionInsight Manager.
  • The Hive client has been installed.

Procedure

For versions earlier than MRS 3.x, perform the following operations to create a Hive role:

  1. Log in to MRS Manager.
  2. Choose System > Permission > Manage Role.
  3. Click Create Role, and set Role Name and Description.
  4. Set permissions. For details, see Table 1.

    • Hive Admin Privilege: Hive administrator permissions. If you want to use this permission, run the set role admin command to set the permission before running SQL statements.
    • Hive Read Write Privileges: Hive data table management permission, which is the operation permission to set and manage the data of created tables. Select the permissions of a database as required. To specify permissions on tables, click the database name and select the permissions of the tables.
    NOTE:
    • Hive role management supports the administrator permission, and the permissions of accessing tables and views, without granting the database permission.
    • The permissions of the Hive administrator do not include the permission to manage HDFS.
    • If there are too many tables in the database or too many files in tables, the permission granting may last a while. For example, if a table contains 10,000 files, the permission granting lasts about 2 minutes.
    Table 1 Setting a role

    Scenario

    Role Authorization

    Setting the Hive administrator permission

    In the Permission table, click Hive and select Hive Admin Privilege.

    NOTE:

    After being bound to the Hive administrator role, perform the following operations during each maintenance operation:

    1. Log in to the node where the client is installed.
    2. Run the following command to configure environment variables:

      For example, if the Hive client installation directory is /opt/hiveclient, run source /opt/hiveclient/bigdata_env.

    3. Run the following command to authenticate the user:

      kinit Hive service user

    4. Run the following command to log in to the client tool:

      beeline

    5. Run the following command to update the administrator permissions:

      set role admin;

    Setting the permission to query a table of another user in the default database

    1. In the Permission table, choose Hive > Hive Read Write Privileges.
    2. In the Permission column of the specified table, select SELECT.

    Setting the permission to query a table of another user in the default database

    1. In the Permission table, choose Hive > Hive Read Write Privileges.
    2. In the Permission column of the specified table, select Insert.

    Setting the permission to import data to a table of another user in the default database

    1. In the Permission table, choose Hive > Hive Read Write Privileges.
    2. In the Permission column of the specified table, select Delete and Insert.

    Setting the permission to submit HQL commands to Yarn for execution

    The HQL commands used by some services are converted into MapReduce tasks and submitted to Yarn for execution. You need to set the Yarn permissions. For example, the HQL statements to be run use statements, such as insert, count, distinct, group by, order by, sort by, or join.

    1. In the Permission table, choose Yarn > Scheduler Queue > root.
    2. In the Permission column of the default queue, select Submit.

  5. Click OK, and return to the Role page.
  6. Choose System > Manage User > Create User.
  7. Enter the username, set User Type to Human-machine, set the user password, add a user group bound with the Hive administrator role, bind the new Hive role to the user group, and click OK.
  8. After the user is created, you can run the SQL statement using the user.

For MRS 3.x or later, perform the following operations to create a Hive role:

  1. Log in to FusionInsight Manager. For details, seeAccessing FusionInsight Manager (MRS 3.x or Later)
  2. Choose System > Permission > Role.
  3. Click Create Role, and set Role Name and Description.
  4. Set Configure Resource Permission. For details, see Table 2.

    • Grant the read and execution permissions for the HDFS directory.
      • Click Name of the desired cluster and select HDFS for Service Name. On the displayed page, click File System, choose hdfs://hacluster/ > user, locate the row where hive is located, and select Read and Execute in the Permission column.
      • Click Name of the desired cluster and select HDFS for Service Name. On the displayed page, click File System, choose hdfs://hacluster/ > user > hive, locate the row where warehouse is located, and select Read and Execute in the Permission column.
      • Click Name of the desired cluster and select HDFS for Service Name. On the displayed page, click File System, choose hdfs://hacluster/ > tmp, locate the row where hive-scratch is located, and select Read and Execute in the Permission column.
    • Hive Admin Privilege: Hive administrator permission.
    • Hive Read Write Privileges: Hive data table management permission, which is the operation permission to set and manage the data of created tables.
    NOTE:
    • In MRS 3.1.0, Hive role management supports the administrator permission, and the permissions of accessing tables and views, without granting the database permission.
    • The permissions of the Hive administrator do not include the permission to manage HDFS.
    • If there are too many tables in the database or too many files in tables, the permission granting may last a while. For example, if a table contains 10,000 files, the permission granting lasts about 2 minutes.
    Table 2 Setting a role

    Task

    Role Authorization

    Setting the Hive administrator permission

    In the Configure Resource Permission table, choose Name of the desired cluster > Hive and select Hive Admin Privilege.

    NOTE:

    After being bound to the Hive administrator role, perform the following operations during each maintenance operation:

    1. Log in to the node where the Hive client is installed as the client installation user.
    2. Run the following command to configure environment variables:

      For example, if the Hive client installation directory is /opt/hiveclient, run source /opt/hiveclient/bigdata_env.

    3. Run the following command to authenticate the user:

      kinit Hive service user

    4. Run the following command to log in to the client tool:

      beeline

    5. Run the following command to update the administrator permissions:

      set role admin;

    Setting the permission to query a table of another user in the default database

    1. In the Configure Resource Permission table, choose Name of the desired cluster > Hive > Hive Read Write Privileges.
    2. Click the name of the specified database in the database list. Tables in the database are displayed.
    3. In the Rights column of the specified table, choose Select.

    Setting the permission to query a table of another user in the default database

    1. In the Configure Resource Permission table, choose Name of the desired cluster > Hive > Hive Read Write Privileges.
    2. Click the name of the specified database in the database list. Tables in the database are displayed.
    3. In the Permission column of the specified table, select INSERT.

    Setting the permission to import data to a table of another user in the default database

    1. In the Configure Resource Permission table, choose Name of the desired cluster > Hive > Hive Read Write Privileges.
    2. Click the name of the specified database in the database list. Tables in the database are displayed.
    3. In the Permission column of the specified indexes, select DELETE and INSERT.

    Setting the permission to submit HQL commands to Yarn for execution

    The HQL commands used by some services are converted into MapReduce tasks and submitted to Yarn for execution. You need to set the Yarn permissions. For example, the HQL statements to be run use statements, such as insert, count, distinct, group by, order by, sort by, or join.

    1. In the Permission table, choose Name of the desired cluster > Yarn > Scheduling Queue > root.
    2. In the Permission column of the default queue, select Submit.

  5. Click OK, and return to the Role page.

We use cookies to improve our site and your experience. By continuing to browse our site you accept our cookie policy. Find out more

Feedback

Feedback

Feedback

0/500

Selected Content

Submit selected content with the feedback