Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Hiveserver2 failed to open new session in beeline

I'm running hive 2.1.1, hadoop 2.7.3 on Ubuntu 16.04.

ps aux | grep hive shows that hiveserver2 is running.

I'm trying to login with user [hive2] and password [password] to hivesever2 through beeline.

Here is my beeline output:

beeline> !connect jdbc:hive2://localhost:10000
Connecting to jdbc:hive2://localhost:10000
Enter username for jdbc:hive2://localhost:10000: 
Enter password for jdbc:hive2://localhost:10000: 
17/02/14 13:51:41 [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: server is not allowed to impersonate anonymous (state=08S01,code=0)

I am able to connect to the embedded mode by entering !connect jdbc:hive2:// in beeline.

Here's my hive-site.xml:

 <configuration>

     <property>
         <name>javax.jdo.option.ConnectionURL</name>
         <value>jdbc:mysql://localhost:3306/hive?createDatabaseIfNotExist=true&amp;useSSL=false</value>
     </property>

     <property>
         <name>javax.jdo.option.ConnectionDriverName</name>
         <value>com.mysql.jdbc.Driver</value>
     </property>

     <property>
         <name>javax.jdo.option.ConnectionUserName</name>
         <value>hive</value>
     </property>

     <property>
         <name>javax.jdo.option.ConnectionPassword</name>
         <value>password</value>
     </property>

     <property>
         <name>beeline.hs2.connection.user</name>
         <value>hive2</value>
     </property>

     <property>
         <name>beeline.hs2.connection.password</name>
         <value>password</value>
     </property>

     <property>
         <name>beeline.hs2.connection.hosts</name>
         <value>localhost:10000</value>
     </property>

 </configuration>

I removed beeline-hs2-connection.xml in case it will overwrite hive-site.xml.

Here's my core-site.xml

 <configuration>
     <property>
         <name>fs.defaultFS</name>
         <value>hdfs://localhost:9000</value>
     </property>

     <property>
         <name>hadoop.proxyuser.centos.groups</name>
         <value>*</value>
     </property>

     <property>
         <name>hadoop.proxyuser.centos.hosts</name>
         <value>*</value>
     </property>

 </configuration>

How could I fix the error and connect to jdbc:hive2://localhost:10000?

Thanks!

like image 454
Top.Deck Avatar asked Feb 14 '17 19:02

Top.Deck


1 Answers

User: server is not allowed to impersonate anonymous

Here server is the user which is attempting to impersonate anonymous user.

Add these properties to core-site.xml and restart the services.

<property>
     <name>hadoop.proxyuser.server.hosts</name> 
     <value>*</value> 
</property> 
<property>
     <name>hadoop.proxyuser.server.groups</name>
     <value>*</value>
</property>
like image 161
franklinsijo Avatar answered Sep 23 '22 01:09

franklinsijo