Connecting to the Apache Livy Thrift Server
You can connect to the Apache Livy Thrift Server using the Beeline client that is included with Apache Hive.
The Livy Thrift Server is disabled by default. Make sure that you have enabled it before proceeding. For instructions, see Configuring the Livy Thrift Server.
The information required to form a JDBC URL is included in the Livy
client configuration file,
/etc/livy/conf/livy-client.conf. Make sure that you
are on a gateway cluster host managed by Cloudera Manager to ensure that
the client configuration is included. You can designate a cluster host
as a Livy client by assigning it the Gateway role
in the Livy service configuration. For more information about role
assignments, see Managing Roles.
Connecting through HAProxy
If the Livy servers run behind HAProxy, connect to the Livy Thrift Server through the load balancer. The connection differs from a direct connection in the following ways:
- Use the
httptransport mode. HAProxy routes requests by cookie, which is not possible inbinarymode. - Use the load balancer FQDN as the host and the port of the HAProxy frontend for the
Thrift Server. That frontend routes by the same
SRV_IDcookie values as the REST frontend, to thelivy.server.thrift.portof each Livy server. - With Kerberos, use the
HTTP/load-balancer-fqdnprincipal. Livy accepts this principal when the Livy Load Balancer Address is set. - Add
httpHeader.Cookie=SRV_ID=srv-id, where srv-id identifies the backend that owns the session, and thelivy.session.nameoption of the session to connect to.
For example:
jdbc:hive2://livy-lb.example.com:<haproxy_thrift_port>/;principal=HTTP/livy-lb.example.com@<REALM>;ssl=true;sslTrustStore=<path_to_truststore>;trustStorePassword=<truststore_password>;transportMode=http;httpHeader.Cookie=SRV_ID=s1;httpPath=cliservice?livy.session.name=<session_name>
To find the SRV_ID value of a session, see Finding the Livy server that owns a
session.
