Search code examples
hadoophivehortonworks-data-platformmetastore

Grant Permission in Hive


I'm trying to set Grant Permissions on Hive 14.0 using Hortonworks Sandbox HDP2.2 as one-node-system. This questions goes similar to unanswered question from march: grant permissions in hive does not work on hdp2.2.

I followed the configuration steps of the a Hive-Wiki.

After log into hive shell (ssh with root) I tried:

CREATE ROLE testing;

FAILED: Execution Error, return code 1 from org.apache.hadoop.hive.ql.exec.DDLTask. Failed to retrieve roles for root: Metastore Authorization api invocation for remote metastore is disabled in this configuration.

If I try the same with another user with hue / beeswax the query finished. If I do

SHOW ROLES;

I got this error, without any log details:

Expected state FINISHED, but found ERROR

My Settings are these (made tags with blanc to show them here)

  • hive-site.xml (those which are listed in the hive-wiki-link)

    <property>
      <name>hive.server2.enable.doAs</name>
      <value>false</value>
    </property>
    <property>
      <name>hive.users.in.admin.role</name>
      <value>hue,hive</value>
    </property>
    <property>
      <name>hive.security.metastore.authorization.manager</name>
      <value>org.apache.hadoop.hive.ql.security.authorization.StorageBasedAuthorizationProvider,org.apache.hadoop.hive.ql.security.authorization.MetaStoreAuthzAPIAuthorizerEmbedOnly</value>
    </property>
    <property>
      <name>hive.security.authorization.manager</name>
      <value>org.apache.hadoop.hive.ql.security.authorization.plugin.sqlstd.SQLStdConfOnlyAuthorizerFactory</value>
    </property>
    
  • hiveserver2-site.xml (all settings)

    <property>
        <name>hive.security.authorization.enabled</name>
        <value>true</value>
    </property>
    <property>
        <name>hive.security.authorization.manager</name>
        <value>org.apache.hadoop.hive.ql.security.authorization.plugin.sqlstd.SQLStdHiveAuthorizerFactory</value>
    </property>
    <property>
        <name>hive.security.authenticator.manager</name>
        <value>org.apache.hadoop.hive.ql.security.SessionStateUserAuthenticator</value>
    </property>
    <property>
        <name>hive.metastore.uris</name>
        <value>''</value>
    </property>
    <property>
        <name>hive.conf.restricted.list</name>
        <value>hive.security.authorization.enabled,hive.security.authorization.manager,hive.security.authenticator.manager</value>
    </property>
    

Hope anyone has an idea.

[Edit]The settings in hive-site.xml were already set - I made there no changes.

[Edit2]After change settings I did hiveserver2 restart and performed a reboot of the sandbox.

[Edit3]Error message comes to every user, not only for root (u can see it at error message). If I try users with admin role (hive-site.xml) like "hive", I got the same error.


Solution

  • Was able to make it runable - thanks to Thejas Nair of Hortonworks.

    Here are the points:

    • You should change all setting with Ambari.
    • Don't change hive.metastore.uris-setting
    • Manually change hiveserver2-site.xml property of hive.security.authorization.manager
    • Copy hiveserver2-site.xml to /etc/hive/conf.server/
    • Restart hiveserver2
    • Use only beeline for SQL permissions