3

I am getting the below error when I try to start Hive using hiverserver2.

Connecting to jdbc:hive2://localhost:10000
18/10/25 09:45:38 [main]: WARN jdbc.HiveConnection: Failed to connect to localhost:10000
Error: Could not open client transport with JDBC Uri: jdbc:hive2://localhost:10000: Failed to open new session: java.lang.RuntimeException: org.apache.hadoop.ipc.RemoteException(org.apache.hadoop.security.authorize.AuthorizationException): User: deco is not allowed to impersonate anonymous (state=08S01,code=0)

The user name I am using is deco.

I have also added the below entry in core-site.xml file:

<property>
    <name>hadoop.proxyuser.deco.hosts</name>
    <value>*</value>
</property>
<property>
    <name>hadoop.proxyuser.deco.groups</name>
    <value>*</value>
</property>

I am still unable to connect using beeline. I used the following commands:

$HIVE_HOME/bin/beeline -u jdbc:hive2://localhost:10000

and

$HIVE_HOME/bin/beeline -n $(whoami) -u jdbc:hive2://localhost:10000

I even took a backup of the metastore_db folder and reinitiated with the below command:

$HIVE_HOME/bin/schematool -dbType derby -initSchema

I even started hiveserver2 on 10001 port and connected beeline to 10001 and still got the same error

All the above prove futile.

Help I am dying

MagnumCodus
  • 171
  • 1
  • 11

1 Answers1

10

I ever got this error

User * is not allowed to impersonate anonymous

That's because by default hive tries to execute operations as the calling user, I add below lines to hive config file conf/hive-site.xml, to ask hive to execute operations as the hiveserver2 process user, then get rid of this error:

  <property>
    <name>hive.server2.enable.doAs</name>
    <value>false</value>
    <description>
      Setting this property to true will have HiveServer2 execute
      Hive operations as the user making the calls to it.
    </description>
  </property>

Here is the document:

Impersonation

By default HiveServer2 performs the query processing as the user who submitted the query. But if the following parameter is set to false, the query will run as the user that the hiveserver2 process runs as.

hive.server2.enable.doAs – Impersonate the connected user, default true.

Fengtao Ding
  • 706
  • 8
  • 17