Support Questions

Find answers, ask questions, and share your expertise

How to use Beeline -u with zk?

avatar
Master Guru

I am able to connect to hive via beeline by issuing

>beeline

and then

>!connect jdbc:hive2://zzz.com:2181,zzzz.com:2181,zzz.com:2181/;serviceDiscoveryMode=zooKeeper;zooKeeperNamespace=hiveserver2

However I would like to connect to hive in 1 shot using -u

>beeline -u jdbc:hive2://zzz.com:2181,zzzz.com:2181,zzz.com:2181/;serviceDiscoveryMode=zooKeeper;zooKeeperNamespace=hiveserver2

and it fails

[LAKE] [smanjee@lake1 ~]# beeline -u jdbc:hive2://z:2181,zzzzz.com:2181,zzzzzz.com:2181/;serviceDiscoveryMode=zooKeeper;zooKeeperNamespace=hiveserver2
SLF4J: Class path contains multiple SLF4J bindings.
SLF4J: Found binding in [jar:file:/usr/hdp/2.5.3.0-37/phoenix/phoenix-4.7.0.2.5.3.0-37-hive.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: Found binding in [jar:file:/usr/hdp/2.5.3.0-37/hadoop/lib/slf4j-log4j12-1.7.10.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.slf4j.impl.Log4jLoggerFactory]
Connecting to jdbc:hive2://zzzzz.com:2181,zzzzz.com:2181,zzzzz.com:2181/
16/12/19 21:56:21 [main]: WARN jdbc.HiveConnection: Failed to connect to zzzzz.com:2181
Error: Could not open client transport with JDBC Uri: jdbc:hive2://zzzzz.com:2181/: null (state=08S01,code=0)
Beeline version 1.2.1000.2.5.3.0-37 by Apache Hive
0: jdbc:hive2://zzzz.com:2 (closed)>
1 ACCEPTED SOLUTION

avatar
Master Guru

HWX support found my issue. here is what I was doing wrong::: Forgot the double quotes around the jdbc driver

beeline -u "jdbc:hive2://example.com:2181,example.com:2181,example:2181/;serviceDiscoveryMode=zooKeeper;zooKeeperNamespace=hiveserver2" 

and now it works. cool. @milind pandit thank you for your help. I am sure port checking should be on the list of what to check. however, the issue where was missing double quotes.

View solution in original post

3 REPLIES 3

avatar

@Sunile Manjee I am able to connect in one shot only after using the same host in the url from where I am running the beeline. e.g if I am running beeline from host z , I was able to connect using beeline -u jdbc:hive2://z:2181/;serviceDiscoveryMode=zooKeeper;zooKeeperNamespace=hiveserver2 I am thinking I might have to open the port 2181 explicitly for other host to access.

avatar

Its working for me , I did the following. 1. Opend the port 2181 2. Stop the local firewall on all nodes. (iptables).

avatar
Master Guru

HWX support found my issue. here is what I was doing wrong::: Forgot the double quotes around the jdbc driver

beeline -u "jdbc:hive2://example.com:2181,example.com:2181,example:2181/;serviceDiscoveryMode=zooKeeper;zooKeeperNamespace=hiveserver2" 

and now it works. cool. @milind pandit thank you for your help. I am sure port checking should be on the list of what to check. however, the issue where was missing double quotes.