How to fix SemanticException No valid privileges error when creating a database with Hive
On a new cluster after connecting as hive via beeline:
/usr/bin/beeline -u "jdbc:hive2://mybdabd1r01s04.mydomain.net:10000/default;principal=hive/mybdad1r01s04.mydomain.net@MYDOMAIN.NET"
When you attempt to create a database (or run some other DML statement) you may receive the error:
0: jdbc:hive2://mybdabd1r01s04:10000/default> create database testdb1 location '/data/warehouse/databases/testdb1';
Error: Error while compiling statement: FAILED: SemanticException No valid privileges
Required privileges for this query: Server=server1->action=*; (state=42000,code=40000)
To resolve this error check that the Hive group is listed as one of the Admin groups in the Sentry configuration (sentry.service.admin.group). Next check that the admin role exists:
show roles;
And the admin role has has permissions on all objects:
show grant role admin;
To grant the hive group the appropriate permissions run the commands:
CREATE ROLE admin;
GRANT ALL ON SERVER server1 TO ROLE admin;
GRANT ROLE admin TO GROUP hive;
Comments
Post a Comment