启动hiveserver2连接不上jdbc:hive2://localhost:10000

启动hiveserver2连接不上localhost:10000,中间试了很多方法,总结就是/hadoop-3.2.1/etc/hadoop的core-site.xml少了以下配置,加入以下配置后问题成功解决。

1、修改hadoop的core-site.xml

进入/hadoop-3.2.1/etc/hadoop的core-site.xml文件,增加以下设置,下面beeline的账号为什么,这是的账号就是什么
     
	hadoop.proxyuser.账号.hosts     
	* 
 
     
	hadoop.proxyuser.账号.groups     
	* 


例如,下面的账号是zheng,那这里就写
     
	hadoop.proxyuser.zheng.hosts     
	* 
 
     
	hadoop.proxyuser.zheng.groups     
	* 


2、保存好后需要重启hadoop

#进入/hadoop-3.2.1/sbin
$ ./stop-all.sh
$ ./start-all.sh

3、重启hiveserver2

#进入hive的bin目录,重启hiveserver2
$ cd /Users/zheng/hive/hive-3.1.2/bin
#启动hivever2
$ hiveserver2

#显示如下表示已经成功打开
2020-04-09 22:34:21: Starting HiveServer2
SLF4J: Class path contains multiple SLF4J bindings.
SLF4J: Found binding in [jar:file:/Users/zheng/hive/hive-3.1.2/lib/log4j-slf4j-impl-2.10.0.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: Found binding in [jar:file:/Users/zheng/hadoop/hadoop-3.2.1/share/hadoop/common/lib/slf4j-log4j12-1.7.25.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]
Hive Session ID = 4d0745ad-5883-453a-ab3a-fc0ca6159a8a
Hive Session ID = dfc3a9b0-2885-4d40-959b-c1c21f167c50
Hive Session ID = e4a979dd-296f-4f1b-9144-b8aa7e97f73c
Hive Session ID = 1bd45534-c8f6-451d-90ba-55b09d51f4c7



4、通过beeline测试是否能成功连接

#另起一个窗口
$ beeline
$ !connect jdbc:hive2://localhost:10000

#输入账号,
$ Enter username for jdbc:hive2://localhost:10000:zheng
#输入密码,这里没有密码直接回车
$ Enter password for jdbc:hive2://localhost:10000:

 

启动hiveserver2连接不上jdbc:hive2://localhost:10000_第1张图片

 

你可能感兴趣的:(hive,hadoop)