Search code examples
hadoophiveimpersonation

cant impersonate on hive server2


Im trying to connect to hive server 2 through a JDBC connector, but Im getting the error:

'user x cant impersonate y'

I added these properties to my core-site.xml file:

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

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

Also, in hive-site.xml I have:

  <property>
    <name>hive.server2.enable.doAs</name>
    <value>true</value>
    <description>
    Setting this property to true will have HiveServer2 execute
    Hive operations as the user making the calls to it.
    </description>
 </property>

I have my authentication set to none and I am connecting as anonymous. I have restarted my cluster since changing the config files as well as running:

hadoop fs -chmod g+w /user/hive/warehouse
hadoop fs -chmod g+w /tmp

Can anyone suggest why Im still getting the error?


Solution

  • If you are trying to connect as user named anonymous, the properties should be

    <property>
         <name>hadoop.proxyuser.anonymous.hosts</name> 
         <value>*</value> 
    </property> 
    <property>
         <name>hadoop.proxyuser.anonymous.groups</name>
         <value>*</value>
    </property>