Beeline cannot connect to hiveserver2

I have an instance of CDH 5.3. I run hive-server2 by first running hive-metastore and then hive-server from the command line. After that, I use beeline to connect to my hive-server2, but apparently it is not.

Could not open connection to jdbc:hive2://localhost:10000: java.net.ConnectException: Connection refused (state=08S01,code=0) 

Another problem, I tried to check if hive-server2 was listening on port 10000. I did " sudo netstat -tulpn | grep :10000 ", but none of the applications appeared. I also added the following property to hive-site.xml, but to no avail. Why is it not showing up in netstat?

 <property> <name>hive.server2.thrift.port</name> <value>10000</value> <description>TCP port number to listen on, default 10000</description> </property> 

The connect command on beeline:

 !connect jdbc:hive2://localhost:10000 org.apache.hive.jdbc.HiveDriver 

when you are asked to enter a username and password, I just enter the test "user" and "passwords" for the corresponding values, and then it gives an error. Any help would be appreciated

+8
source share
8 answers

Beehive Connection to Beeline from a client having various modes.

1. Built-in mode: both Server and Client work on one computer. TCP connection is not 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 perform requests using the 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

Recommendations:

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

+7
source

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

There may be another reason why you were not able to start hive-server2 , but you should definitely look into this log file.

+2
source

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

  >hive --service hiverserver2 & 

The process ID for Hiverver2 appears in the console. Then try connecting to the beeline with a beeline using another terminal:

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

In this case, your hiveserver2 service was not started. Please follow the removal instructions to check and fix. step: 1.see hive.log file to check "Service: HiveServer2 is running".

 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 find "Service: HiveServer2 is running." in hive.log. then connect hiveserver2 by beeline.

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

5. Information can be found.

 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 
+1
source

you need to specify the hiveserver2 username and password, check it in hive-site.xml by default, username (anonymous) and password (anonymous), otherwise just enter enter without specifying a password and username.

0
source

try with the detailed option so you can see more detailed information ...

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

Please make sure the deployment IP address is hive2service.

I am facing the same problem, I am using cloudera server ip (XXX.42) to connect the hive2 service; but actually the savings on the bushes (hive2service) are delayed by another machine (XXX.41).

0
source

Failure to connect means that the HiveServer2 service is probably not starting successfully. You can confirm this by looking at the hive.log file.

You can refer to my next post to find out how to solve the HiveServer2 problem if this happens because the connection to the Hive metastore is denied.

https://kontext.tech/docs/DataAndBusinessIntelligence/p/hiveserver2-cannot-connect-to-hive-metastore-resolutionsworkarounds

0
source

Source: https://habr.com/ru/post/1214824/


All Articles