错误提示:Error: Could not open client transport with JDBC Uri: jdbc:hive2://hadoop102:10000: Failed to open new session: java.lang.RuntimeException: org.apache.hadoop.ipc.RemoteException(org.apache.hadoop.security.authorize.AuthorizationException): User: atguigu is not allowed to impersonate atguigu (state=08S01,code=0)
Beeline version 3.1.2 by Apache Hive
Could not open connection to the HS2 server. Please check the server URI and if the URI is correct, then ask the administrator to check the server status.
Error: Could not open client transport with JDBC Uri: jdbc:hive2://hadoop102:10000: java.net.ConnectException: 拒绝连接 (Connection refused) (state=08S01,code=0)
解决方案:
在安装hadoop路径修改core-site.xml,给此文件添加一下内容,注意里面写的atguigu,就是安装hadoop集群的用户名,也就是上面错误提示中显示没有权限的用户名,如下
结合自己情况,改为自己安装 hadoop 集群的用户名
<!-- 处理beeline端问题 -->
<property>
<name>hadoop.proxyuser.atguigu.hosts</name>
<value>*</value>
</property>
<property>
<name>hadoop.proxyuser.atguigu.groups</name>
<value>*</value>
</property>
安装此步骤走,重启hadoop集群、重启metastore、重启hiveserver2;
在安装hive路径下,命令端口输入:beeline
再输入:
先执行 beeline
然后输入:!connect jdbc:hive2://hadoop102:10000 按回车,其中hadoop102是安装hiveserver2所在主机ip地址
然后输入用户名,这个用户名就是安装 hadoop 集群的用户名 atguigu
再输入用户名对应的开机密码
成功如下;