Hiveserver2 failed to open new session in beeline

Top.Deck picture Top.Deck · Feb 14, 2017 · Viewed 8.1k times · Source

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!

Answer

franklinsijo picture franklinsijo · Feb 14, 2017

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>