Support Questions

Find answers, ask questions, and share your expertise

unable to connect thrift server using beeline

avatar
Explorer

when am connecting to thrift server using beeline it's showing  below error

Beeline version 1.2.1.spark2 by Apache Hive
beeline> !connect jdbc:hive2://host:10000
Connecting to jdbc:hive2://host:10000
Enter username for jdbc:hive2://host:10000: admin-sbarik2
Enter password for jdbc:hive2://host:10000: ********
org/apache/hive/service/cli/thrift/TCLIService$Iface
0: jdbc:hive2://host:10000 (closed)>

 

it's automatically closed.

1 ACCEPTED SOLUTION

avatar
Explorer

actually in oracle Database previously am not entry  my user id and password 

after entry the same connection is established. It's a minor issue

 

thanks for your support.

 

View solution in original post

20 REPLIES 20

avatar
Master Mentor

@soumya 

 

Have you tried the below method?

$ beeline -u jdbc:hive2://osaka.com:10000 -n hive -p hive
.........
SLF4J: Actual binding is of type [org.apache.logging.slf4j.Log4jLoggerFactory]
Connecting to jdbc:hive2://osaka.com:10000
Connected to: Apache Hive (version 3.1.0.3.1.0.0-78)
Driver: Hive JDBC (version 3.1.0.3.1.0.0-78)
Transaction isolation: TRANSACTION_REPEATABLE_READ
Beeline version 3.1.0.3.1.0.0-78 by Apache Hive
0: jdbc:hive2://osaka.com:10000> show databases;
INFO : Compiling command(queryId=hive_20191018215530_3f94b050-d36c-46c9-9582-40a0fef9b6e2): show databases
...........
INFO : Completed executing command(queryId=hive_20191018215530_3f94b050-d36c-46c9-9582-40a0fef9b6e2); Time taken: 0.037 seconds
INFO : OK
+---------------------+
| database_name |
+---------------------+
| default |
| information_schema |
| sparktest |
| sys |
+---------------------+
4 rows selected (0.392 seconds)
0: jdbc:hive2://osaka.com:10000>

 

 

avatar
Explorer

no luck same issue it's automatically closed

Connecting to beeline
-n
log4j:WARN No appenders could be found for logger (org.apache.hive.beeline.SQLCompleter).
log4j:WARN Please initialize the log4j system properly.
log4j:WARN See http://logging.apache.org/log4j/1.2/faq.html#noconfig for more info.
0: beeline (closed)>

avatar
Master Mentor

@soumya 

Following from my previous responses  can you get the connection string like below

 

Ambari UI --> Hive --> Summary (Tab) --> "HiveServer2 JDBC URL" --> Click on the at the right side of the URL to copy the URL and then try this URL with beeline once
At the prompt add beeline to the copied link above.

 connect1a.PNG

 

# beeline jdbc:hive2://osaka.com:2181/;serviceDiscoveryMode=zooKeeper;zooKeeperNamespace=hiveserver2
SLF4J: Class path contains multiple SLF4J bindings.
SLF4J: Found binding in [jar:file:/usr/hdp/3.1.0.0-78/hive/lib/log4j-slf4j-impl-2.10.0.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: Found binding in [jar:file:/usr/hdp/3.1.0.0-78/hadoop/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]
Connecting to jdbc:hive2://osaka.com:2181/default;serviceDiscoveryMode=zooKeeper;zooKeeperNamespace=hiveserver2
Enter username for jdbc:hive2://osaka.com:2181/default: hive
Enter password for jdbc:hive2://osaka.com:2181/default: ****
19/10/19 09:40:50 [main]: INFO jdbc.HiveConnection: Connected to osaka.com:10000
Connected to: Apache Hive (version 3.1.0.3.1.0.0-78)
Driver: Hive JDBC (version 3.1.0.3.1.0.0-78)
Transaction isolation: TRANSACTION_REPEATABLE_READ
Beeline version 3.1.0.3.1.0.0-78 by Apache Hive
0: jdbc:hive2://osaka.com:2181/default> show tables;
INFO : Compiling command(queryId=hive_20191019094333_357978cc-2f7d-433f-badc-6d8f20178361): show tables
..........
INFO : Completed executing command(queryId=hive_20191019094333_357978cc-2f7d-433f-badc-6d8f20178361); Time taken: 11.262 seconds
INFO : OK
+-------------+
| tab_name |
+-------------+
| hello_acid |
+-------------+
1 row selected (77.143 seconds)
0: jdbc:hive2://osaka.com:2181/default>

connect2.PNG

 

 

connect3.PNG

 

Specifying a database in the connect string

 

# beeline -u "jdbc:hive2://osaka.com:2181/sparktest;serviceDiscoveryMode=zooKeeper;zooKeeperNamespace=hiveserver2"
SLF4J: Class path contains multiple SLF4J bindings.
...........
Connecting to jdbc:hive2://osaka.com:2181/sparktest;serviceDiscoveryMode=zooKeeper;zooKeeperNamespace=hiveserver2
19/10/19 10:01:21 [main]: INFO jdbc.HiveConnection: Connected to osaka.com:10000
Connected to: Apache Hive (version 3.1.0.3.1.0.0-78)
Driver: Hive JDBC (version 3.1.0.3.1.0.0-78)
Transaction isolation: TRANSACTION_REPEATABLE_READ
Beeline version 3.1.0.3.1.0.0-78 by Apache Hive
0: jdbc:hive2://osaka.com:2181/sparktest> show tables;

 

Methods of Hs2 connections

HiveServer2 and a JDBC client (such as Beeline) as the primary way to access Hive. It uses SQL standard-based authorization or Ranger-based authorization. However if  wish to access Hive data from other applications, such as Pig. For these use cases, use the Hive CLI and storage-based authorization.
HS2 using Binary Transport Mode

beeline jdbc:hive2://<ZOOKEEPER QUORUM>/;serviceDiscoveryMode=zooKeeper;zooKeeperNamespace=hiveserver2HiveServer2

HS2 using HTTP Transport Mode

beeline jdbc:hive2://<ZOOKEEPER QUORUM>/;serviceDiscoveryMode=zooKeeper;zooKeeperNamespace=hiveserver2;transportMode=http;httpPath=cliservice

HS2 Interactive note zooKeeperNamespace=hiveserver2-hive2 in the below URL

beeline jdbc:hive2://<ZOOKEEPER QUORUM>/;serviceDiscoveryMode=zooKeeper;zooKeeperNamespace=hiveserver2-hive2

HS2 Scripts using Beeline, you can make use of -f option in Beeline.

beeline -u "jdbc:hive2://master01:2181,master02:2181,master03:2181/;serviceDiscoveryMode=zooKeeper;zooKeeperNamespace=hiveserver2" -f file.hql

The above methods should succeed.

 

 

avatar
Explorer

can you share before i connecting to spark thrift server with beeline what configuration need to check ...???

what i  think something wrong with configuration file....

avatar
Master Mentor

@soumya 

Can you share the output od the below

 

Ambari UI --> Hive --> Summary (Tab) --> "HiveServer2 JDBC URL" --> Click on the at the right side of the URL to copy the URL 

I see you using port 10001 ???

connect4.PNG

connect4a.PNG

 What is the output from your Linux console of

 

$ hostname  -f

You should append that derived  value i.e soumya.com to the connect string

 

 

 

avatar
Explorer

facing below error

#-> ./bin/beeline
Beeline version 1.2.1.spark2 by Apache Hive
beeline> !connect jdbc:hive2://host:10001
Connecting to jdbc:hive2://host:10001
Enter username for jdbc:hive2://host:10001: SBarik2
Enter password for jdbc:hive2://host:10001: ********
org/apache/hive/service/cli/thrift/TCLIService$Iface
0: jdbc:hive2://host:10001 (closed)>

 

can you share what configuration need to check 

avatar
Explorer

please suggest facing below issue

Beeline version 1.2.1.spark2 by Apache Hive
beeline> !connect jdbc:hive2//awsdev2185:10000
scan complete in 0ms
19/10/20 04:49:36 ERROR ClassNameCompleter: Fail to parse the class name from the Jar file due to the exception:java.io.FileNotFoundException: minlog-1.2.jar (No such file or directory)
19/10/20 04:49:37 ERROR ClassNameCompleter: Fail to parse the class name from the Jar file due to the exception:java.io.FileNotFoundException: objenesis-1.2.jar (No such file or directory)
19/10/20 04:49:37 ERROR ClassNameCompleter: Fail to parse the class name from the Jar file due to the exception:java.io.FileNotFoundException: reflectasm-1.07-shaded.jar (No such file or directory)
scan complete in 1177ms
No known driver to handle "jdbc:hive2//awsdev2185:10000"

avatar
Master Mentor

@soumya 

when I ask you to share output there is a valid reason for that but when you continue to send me errors I can figure out what could be the issue because the errors are different each time.

 

In all my previous posting I requested outputs or screenshots !!

Like the Hs2 connect string from the Ambari UI, /etc/hosts and output of $ hostname -f, etc

 

What is the backend database you are using for hive?

 

 

avatar
Explorer

backend database am using spark-sql