直线无法连接到hiveserver2

tin*_*s91 11 hadoop hive cloudera cloudera-manager

我有一个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)
Run Code Online (Sandbox Code Playgroud)

另一个问题,我试着看看hive-server2是否正在侦听端口10000.我做了" 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>
Run Code Online (Sandbox Code Playgroud)

beeline上的connect命令:

!connect jdbc:hive2://localhost:10000 org.apache.hive.jdbc.HiveDriver
Run Code Online (Sandbox Code Playgroud)

当被要求输入用户名和密码时,我只输入相应值的测试"user"和"password",然后抛出错误.任何帮助将不胜感激

VM *_* MP 11

Hive从具有各种模式的客户端连接到直线.

1.嵌入式模式: 服务器和客户端都在同一台机器上运行.无需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://
Run Code Online (Sandbox Code Playgroud)

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
Run Code Online (Sandbox Code Playgroud)

希望这对你有所帮助

参考文献:

https://docs.hortonworks.com/HDPDocuments/HDP2/HDP-2.3.2/bk_dataintegration/content/beeline-vs-hive-cli.html

  • 很好的帮助!我的问题是,即使我设置了NOSASL,我也没有把'auth = noSasl`.谢谢! (2认同)

小智 2

我在这里也遇到了同样的问题。这只是因为hiveserver2启动失败——错误不会显示在控制台中,而是显示在配置单元日志中。就我而言,配置单元日志位于/tmp/ubuntu/hive.log

可能有不同的原因导致hive-server2启动失败,但绝对值得查看此日志文件。