User root is not allowed to impersonate anonymous

时间:2023-03-10 04:35:40
User root is not allowed to impersonate anonymous

User root is not allowed to impersonate anonymous

ava.lang.RuntimeException: org.apache.hadoop.ipc.RemoteException(org.apache.hadoop.security.authorize.AuthorizationException): User: wulei is not allowed to impersonate hadoop), serverProtocolVersion:null) (state=08S01,code=0)

使用HiveServer2 and Beeline模式运行时,启动好HiveServer后运行

beeline -u jdbc:hive2://localhost:10000 -n root 连接server时
出现
java.lang.RuntimeException: org.apache.hadoop.ipc.RemoteException(org.apache.hadoop.security.authorize.AuthorizationException): 
User root is not allowed to impersonate anonymous 错误。

  • 修改hadoop 配置文件 etc/hadoop/core-site.xml,加入如下配置项

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

hadoop.proxyuser.root.hosts配置项名称中root部分为报错User:* 中的用户名部分,如wulei!!!!!!!

例如User: zhaoshb is not allowed to impersonate anonymous则需要将xml变更为如下格式

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

  • 重启hadoop
  • 测试:./beeline -u 'jdbc:hive2://localhost:10000/userdb' -n username(替换为上述的用户名部分)