Support Questions

Find answers, ask questions, and share your expertise

Cannot connect to beeline

avatar
Expert Contributor

I am trying to connect beeline from client system but I am not able to...

 

Beeline version 0.10.0-cdh4.5.0 by Apache Hive
beeline> !connect jdbc:hive2://hostname.com:10000 org.apache.hadoop.hive.jdbc.HiveDriver
scan complete in 6ms
Connecting to jdbc:hive2://hostname.com:10000
Enter password for jdbc:hive2://hostname.com:10000: ********
Error: Invalid URL: jdbc:hive2://hostname.com:10000 (state=08S01,code=0)

 

Am I missing anything here...Please advice..

 

Em Jay
1 ACCEPTED SOLUTION

avatar
Expert Contributor
This solved my problem....I was using the wrong syntax. Below is the right one...
!connect jdbc:hive2://hostname:10000/default;principal=hive/hostname@PRINCIPAL.COM
username and password blank....

Thanks for helping me out zhang...
Em Jay

View solution in original post

38 REPLIES 38

avatar
Cloudera Employee
It looks like that your hive-site.xml specified kerberos authentication.
You need to specify principal in your url, such as

beeline -u jdbc:hive2://host:port;pricipal=principal_name

principal_name is specified in hive-site.xml.

Also, before you connect, you need to do kerberos kinit to get
authentication token.

I suggest you turn off authentication first and make sure you can connect
to your server. Then, turn on authentication back.

avatar
Expert Contributor

No luck...

 

$ beeline -u jdbc:hive2://hostname:10000;principal=PRINCIPAL.COMPANY.COM
scan complete in 10ms
Connecting to jdbc:hive2://hostname:10000
Error: Invalid URL: jdbc:hive2://hostname:10000 (state=08S01,code=0)
Beeline version 0.10.0-cdh4.5.0 by Apache Hive

Em Jay

avatar
Cloudera Employee

avatar
Expert Contributor

I don't see the below properties in my hive-site.xml

 

<property> <name>hive.server2.authentication</name> <value>KERBEROS</value> </property> 

 

<property> <name>hive.server2.authentication.kerberos.keytab</name><value>/etc/hive/conf/hive.keytab</value> </property>

 

You want me to try adding these properties to the conf....will it help ?

Em Jay

avatar
Cloudera Employee

I saw previously: Unable to login to kerberos with given principal/keytab, which made me assume you had kerberos turned on.

 

It's better to test beeline connection without kerberos on. Could you check your hiverserver2 log?

 

 

avatar
Expert Contributor

I see belo error in logs

 

Error occurred during processing of message.
java.lang.RuntimeException: org.apache.thrift.transport.TTransportException
    at org.apache.thrift.transport.TSaslServerTransport$Factory.getTransport(TSaslServerTransport.java:219)
    at org.apache.hadoop.hive.thrift.HadoopThriftAuthBridge20S$Server$TUGIAssumingTransportFactory$1.run(HadoopThriftAuthBridge20S.java:648)
    at org.apache.hadoop.hive.thrift.HadoopThriftAuthBridge20S$Server$TUGIAssumingTransportFactory$1.run(HadoopThriftAuthBridge20S.java:646)
    at java.security.AccessController.doPrivileged(Native Method)
    at javax.security.auth.Subject.doAs(Subject.java:356)
    at org.apache.hadoop.security.UserGroupInformation.doAs(UserGroupInformation.java:1388)
    at org.apache.hadoop.hive.thrift.HadoopThriftAuthBridge20S$Server$TUGIAssumingTransportFactory.getTransport(HadoopThriftAuthBridge20S.java:646)
    at org.apache.thrift.server.TThreadPoolServer$WorkerProcess.run(TThreadPoolServer.java:227)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
    at java.lang.Thread.run(Thread.java:724)
Caused by: org.apache.thrift.transport.TTransportException
    at org.apache.thrift.transport.TIOStreamTransport.read(TIOStreamTransport.java:132)
    at org.apache.thrift.transport.TTransport.readAll(TTransport.java:84)
    at org.apache.thrift.transport.TSaslTransport.receiveSaslMessage(TSaslTransport.java:178)
    at org.apache.thrift.transport.TSaslServerTransport.handleSaslStartMessage(TSaslServerTransport.java:125)
    at org.apache.thrift.transport.TSaslTransport.open(TSaslTransport.java:253)
    at org.apache.thrift.transport.TSaslServerTransport.open(TSaslServerTransport.java:1)
    at org.apache.thrift.transport.TSaslServerTransport$Factory.getTransport(TSaslServerTransport.java:216)
    ... 10 more

Em Jay

avatar
Cloudera Employee
This is not helpful. Last thing, in the log, do you see incoming
connections?

avatar
Expert Contributor
All I see is the above log repeating again and again....I don't see any other error log...
Em Jay

avatar
Cloudera Employee
$ beeline -u jdbc:hive2://hostname:10000
scan complete in 10ms
Connecting to jdbc:hive2://hostname:10000
Error: Invalid URL: jdbc:hive2://hostname:10000 (state=08S01,code=0)
Beeline version 0.10.0-cdh4.5.0 by Apache Hive
0: jdbc:hive2://hostname.c>

You might have already connected.

try command show databases;

avatar
Expert Contributor
No luck.
0: jdbc:hive2://hostname.c> show databases;
No current connection
0: jdbc:hive2://hostname.c>
Em Jay