问题:
hiveserver2连接报错: User: root is not allowed to impersonate anonymous (state=08S01,code=0)
[root@node01 ~]# beeline -u jdbc:hive2://node01:10000 -n hive SLF4J: Class path contains multiple SLF4J bindings. SLF4J: Found binding in [jar:file:/opt/soft/hive-3.1.3/lib/log4j-slf4j-impl-2.17.1.jar!/org/slf4j/impl/StaticLoggerBinder.class] SLF4J: Found binding in [jar:file:/opt/soft/hadoop-3.3.3/share/hadoop/common/lib/slf4j-reload4j-1.7.36.jar!/org/slf4j/impl/StaticLoggerBinder.class] SLF4J: See http://www.slf4j.org/codes.html#multiple_bindings for an explanation. SLF4J: Actual binding is of type [org.apache.logging.slf4j.Log4jLoggerFactory] Connecting to jdbc:hive2://node01:10000 22/06/02 14:57:51 [main]: WARN jdbc.HiveConnection: Failed to connect to node01:10000 Error: Could not open client transport with JDBC Uri: jdbc:hive2://node01:10000: 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 hive (state=08S01,code=0) Beeline version 3.1.3 by Apache Hive
解决:
1:在hadoop/etc/hadoop目录下的core-site.xml文件添加下列参数
配置root(超级⽤户)允许通过代理的⽤户
vim core-site.xml
hadoop.proxyuser.root.hosts * hadoop.proxyuser.root.groups *
2:hive/conf目录hive-site.xml添加下列参数
默认情况下,HiveServer2 以提交查询的用户身份执行查询处理。但是如果以下参数设置为false,则查询将以hiveserver2进程运行的用户身份运行。
默认为true
hive.server2.enable.doAs false
hive.server2.enable.doAs设置成false,yarn作业获取到的hiveserver2用户都为hive用户,true为实际提交作业的用户。



