Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

like image 650
sergio.nava Avatar asked Apr 03 '17 08:04

sergio.nava


1 Answers

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

ref: https://cwiki.apache.org/confluence/display/Hive/Setting+Up+HiveServer2#SettingUpHiveServer2-Impersonation

Alternatively, you can also set the parameter hive.server2.enable.doAs to false to disable user impersonation.

like image 100
franklinsijo Avatar answered Nov 26 '22 09:11

franklinsijo