HortonWorks Hive enable auth using Ambari users

HortonWorks Hive enable auth using Ambari users

configure the admin users on Ambari

Access -> Hive -> Configs -> Advanced -> Custom hive-site -> Add Property
hive.users.in.admin.role=hive,admin

Save and reload hive.

Connect to the SSH of you hadoop cluster then run beeline and connect using hive and password hive command:

$ beeline
Beeline version 1.2.1000.2.6.1.0-129 by Apache Hive
beeline> !connect jdbc:hive2://hadoop-2:10000 hive hive  org.apache.hive.jdbc.HiveDriver
Connecting to jdbc:hive2://hadoop-2:10000
Connected to: Apache Hive (version 1.2.1000.2.6.1.0-129)
Driver: Hive JDBC (version 1.2.1000.2.6.1.0-129)
Transaction isolation: TRANSACTION_REPEATABLE_READ

Set the admin role to hive user

0: jdbc:hive2://hadoop-2:10000> SET ROLE ADMIN;
No rows affected (2.192 seconds)

Create basic roles (*Optional*)

Create 2 roles one for read-only users and another one for read-write users;

1: jdbc:hive2://hadoop-2:10000> create role RWUSER;
No rows affected (0.229 seconds)
1: jdbc:hive2://hadoop-2:10000> create role ROUSER;
No rows affected (0.221 seconds)
1: jdbc:hive2://hadoop-2:10000> ALTER DATABASE DEFAULT SET OWNER ROLE RWUSER;

Enable Security Authorization

Go to Hive -> Config -> Settings -> Choose Authorization -> SQLStdAuth.

Save and Reload Hive

Leave a Reply

Your email address will not be published. Required fields are marked *