beeline not able to connect to hiveserver2

落爺英雄遲暮 提交于 2019-12-03 06:08:48

Hive Connecting to beeline from client having various Modes.

1.Embedded Mode: Both Server and Client runs in same machine. No TCP Connection required.

 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. Remote Mode: It supports multiple clients to execute queries with help of following Authentication schemes.

Authentication Schemes:

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

Hope this really helps you

References:

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

huang shuming

I had the same problem here. This is simply because hiveserver2 failed to start -- the error does not show up in console, but in hive logs. In my case, hive logs are located in /tmp/ubuntu/hive.log

There might be different reason for you to cause hive-server2 failed to start, but it definitely worth to look into this log file.

In this case,your hiveserver2 service was not started.please follow blow steps to check and fix. step: 1.see hive.log file to check "Service:HiveServer2 is started."

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 command: ./bin/hiveserver2

3.see hive.log。 if you can find "Service:HiveServer2 is started." in hive.log. then connect hiveserver2 by beeline.

4.connect hiveserver2 ./bin/beeline !connect jdbc:hive2://localhost:10000

5.below information can appeare.

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

The following worked for me. If you installed and configured hive for the first time and trying to connect from beeline, make sure you start the hive service using the following command in the current terminal

 >hive --service hiverserver2 &

The process id for Hiverver2 appears in the console.Then retry connecting to hive from beeline using different terminal:

 >beeline -u "jdbc:hive2://localhost:10000/default" -n <username> -p <password> -d "org.apache.hive.jdbc.HiveDriver"

you have to give hiveserver2 username and password check it in hive-site.xml by default username(anonymous) and password(anonymous) otherwise just give enter without giving password and username.

try with verbose option so you can see more details...

beeline -u "jdbc:hive2://localhost:10000/default;user=user;password=*******" --verbose

Please make sure the hive2service deployment IP.

I meet the same problem, I use the cloudera server ip(XXX.42) to connect the hive2 service; but in fact hive thrift service(hive2service) is depoyed on other machine(XXX.41).

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!