简体   繁体   中英

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

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.

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/%3C54b7754ceb8370b7250bba929369763f@cloudtechnologypartners.co.uk%3E

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM