'Cannot connect to hive using beeline, user root cannot impersonate anonymous
I'm trying to connect to hive using beeline !connect jdbc:hive2://localhost:10000
and I'm being asked for a username and password
Connecting to jdbc:hive2://localhost:10000'
Enter username for jdbc:hive2://localhost:10000:
Enter password for jdbc:hive2://localhost:10000:
As I don't know what username or password I'm supposed to type in I'm leaving it empty which causes the error: Error: Failed to open new session: java.lang.RuntimeException: org.apache.hadoop.ipc.RemoteException(org.apache.hadoop.security.authorize.AuthorizationException): User: root is not allowed to impersonate anonymous (state=,code=0)
My setup is a single node hadoop cluster in ubuntu.
I can confirm that the services are up and running, both hadoop and hiveserver2
The question is , what are these username and password I'm being asked, where can I find them or set them?
Thanks in advance
Solution 1:[1]
You should provide a valid username
and password
that has privileges to access the HDFS and Hive Services (user
running HiveServer2). For your setup, the user
in which Hadoop and Hive are installed would be the superuser.
These credentials will be used by beeline
to initiate a connection with HiveServer2.
And, add these properties in core-site.xml
<property>
<name>hadoop.proxyuser.username.groups</name>
<value>*</value>
</property>
<property>
<name>hadoop.proxyuser.username.hosts</name>
<value>*</value>
</property>
Restart services after adding these properties.
Then run beeline
with the specified user name username
as below:
beeline -u jdbc:hive2://localhost:10000 -u username
Alternatively, you can also set the parameter hive.server2.enable.doAs
to false
to disable user impersonation.
Solution 2:[2]
In hive-site.xml need to set the parameter hive.server2.enable.doAs to false
<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>
http://mail-archives.apache.org/mod_mbox/hive-user/201602.mbox/%[email protected]%3E
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|---|
Solution 1 | ROY |
Solution 2 | ssyue |