异常现象
beeline> !connect jdbc:hive2://sh01:10000
Connecting to jdbc:hive2://sh01:10000
Enter username for jdbc:hive2://sh01:10000:
Enter password for jdbc:hive2://sh01:10000:
22/07/19 16:22:41 [main]: WARN jdbc.HiveConnection: Failed to connect to sh01:10000
Error: Could not open client transport with JDBC Uri: jdbc:hive2://sh01:10000: Failed to open new session: java.lang.RuntimeException: org.apache.hadoop.ipc.RemoteException(org.apache.hadoop.security.authorize.AuthorizationException): User: deployer is not allowed to impersonate anonymous (state=08S01,code=0)
解决办法:
在 ${HIVE_HOME}/conf/hive-site.xml
中将配置修改成
<property>
<name>hive.server2.enable.doAs</name>
<value>false</value>
<description>
Setting this property to true will have HiveServer2 execute
Hive operations as the user making the calls to it.
</description>
</property>
然后再重新启动 metastore 和 hiveserver2,最后再用 beeline 连接。