错误描述:
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://hadoop132:10000: java.net.ConnectException: Connection refused (Connection refused) (state=08S01,code=0)
往下阅读之前首先确定一下你已经执行了该命令(启动hiveserver)
bin/hive --service hiveserver2
在连接的时候发现报错,继续往下看
根本原因:
hiveserver2没启动起来,默认配置的是10000端口号,查看一下:
netstat -anop|grep 10000
如果没东西的话那就证明肯定是没启动的,你都报这个错误了,那肯定是没有端口占用的。
解决方法:
1.检查hadoop是否正确启动
jps
正常要有下面四个:没有的话就重新配置一下hadoop吧
2.检查一下hadoop安全模式有没有关闭
hdfs dfsadmin -safemode get
如果是图示:(OFF就是关闭,反之ON就是开启状态,需要关闭)
?你的为啥只有一条,因为我的是高可用HA,有一条也是对的
退出安全模式:
hdfs dfsadmin -safemode leave
然后再重新连接一下hive就好了
3.高可用版本报错:
查看你当前节点是否为工作状态
hdfs haadmin -getServiceState <your_namenodeName>
如果是 standby,说明不在工作状态,那肯定是连不上的
hdfs haadmin -transitionToActive --forcemanual <your_namenodeName>
启动一下,然后再启动hiveserver,在连接就可以了
成功截图:
命令行连接
DataGrip连接: