我有一个CDH 5.3实例。 我首先启动hive-metastore,然后从命令行启动hive-server,启动hive-server2。 在此之后我使用beeline连接到我的hive-server2,但显然它不能这样。
Could not open connection to jdbc:hive2://localhost:10000: java.net.ConnectException: Connection refused (state=08S01,code=0)
另一个问题,我试着看看hive-server2是否正在侦听端口10000。
我做了#34; sudo netstat -tulpn | grep :10000
"但没有一个应用程序出现。
我还在hive-site.xml中添加了以下属性,但无济于事。为什么它不会出现在netstat上?
<property>
<name>hive.server2.thrift.port</name>
<value>10000</value>
<description>TCP port number to listen on, default 10000</description>
</property>
beeline上的connect命令:
!connect jdbc:hive2://localhost:10000 org.apache.hive.jdbc.HiveDriver
当被问及用户名和密码时,我只需输入test&#34; user&#34;和#34;密码&#34; 对于相应的值,然后它会抛出错误。 任何帮助将不胜感激
答案 0 :(得分:8)
Hive从具有各种模式的客户端连接到直线。
1.嵌入式模式: Server和Client都在同一台机器上运行。无需TCP连接。
If hive.server2.authentication is "NONE" in HIVE_HOME/conf/hive-site.xml then connect beeline with below url
Connection URL:
!connect jdbc:hive2://
<强> 2。远程模式: 它支持多个客户端在以下身份验证方案的帮助下执行查询。
身份验证方案:
i.)SASL Authentication:
If value of "hive.server2.authentication" property in HIVE_HOME/conf/hive-site.xml to be set as "SASL" then connect hive beeline with below url
Beeline URL:
!connect jdbc:hive2://<host>:<port>/<db>
ii.)NOSASL Authentication:
If "hive.server2.authentication" is nosasl then connect the beeline like below.
Beeline URL:
!connect jdbc:hive2://<host>:<port>/<db>;auth=noSasl
希望这真的有助于你
参考文献:
答案 1 :(得分:2)
我在这里遇到了同样的问题。
这只是因为hiveserver2
无法启动 - 错误不会显示在控制台中,而是显示在配置单元日志中。就我而言,配置单元日志位于/tmp/ubuntu/hive.log
您可能有不同的原因导致hive-server2
无法启动,但绝对值得查看此日志文件。
答案 2 :(得分:2)
在这种情况下,您的hiveserver2服务未启动。请按照打击步骤进行检查和修复。 步: 1.查看hive.log文件以检查&#34;服务:HiveServer2已启动。&#34;
1) find / -name hive.log
2) vim hive.log
in hive.log file ,if you can not find "Service:HiveServer2 is started.",then prove hiveserver2 is not started.
2.start hiveserver2 命令:./ bin / hiveserver2
3.查看hive.log。 如果你能找到&#34;服务:HiveServer2已启动。&#34;在hive.log中。然后用直线连接hiveserver2。
4.connect hiveserver2 ./bin/beeline !connect jdbc:hive2:// localhost:10000
5.信息可以显示出来。
Beeline version 1.2.1 by Apache Hive
beeline> !connect jdbc:hive2://localhost:10000
Connecting to jdbc:hive2://localhost:10000
Enter username for jdbc:hive2://localhost:10000: root
Enter password for jdbc:hive2://localhost:10000: ******
Connected to: Apache Hive (version 1.2.1)
Driver: Hive JDBC (version 1.2.1)
Transaction isolation: TRANSACTION_REPEATABLE_READ
答案 3 :(得分:1)
以下对我有用。如果您是第一次安装并配置了配置单元并尝试从直连连接,请确保使用当前终端中的以下命令启动配置单元服务
>hive --service hiverserver2 &
Hiverver2的进程ID出现在控制台中。然后使用不同的终端重新从beeline连接到hive:
>beeline -u "jdbc:hive2://localhost:10000/default" -n <username> -p <password> -d "org.apache.hive.jdbc.HiveDriver"
答案 4 :(得分:0)
您必须使用默认用户名(匿名)和密码(匿名)在hive-site.xml中提供hiveserver2用户名和密码,否则只需输入而不提供密码和用户名。
答案 5 :(得分:0)
尝试使用详细选项,以便您可以查看更多详细信息......
beeline -u "jdbc:hive2://localhost:10000/default;user=user;password=*******" --verbose
答案 6 :(得分:0)
请确保hive2service部署IP。
我遇到同样的问题,我使用cloudera服务器ip(XXX.42)连接hive2服务;但事实上蜂巢节俭服务(hive2service)在其他机器上被驱逐(XXX.41)。