Community Articles
Find and share helpful community-sourced technical articles
Alert: Welcome to the Unified Cloudera Community. Former HCC members be sure to read and learn how to activate your account here.
New Contributor

This is the process to load balance zookeeper's behind a haproxy LB and the can be used for any other components as well .

1) Install HAproxy

yum install haproxy

2) Edit /etc/haproxy/haproxy.cfg and append the below config

#This specifies port which the end users will use to access zookeeper.

listen appname

#Specifies the access method tcp/http/udp , should be tcp for zookeeper

mode tcp

#Algorithm used for balancing requests

balance roundrobin

#It forwards the client ip requesting the service to zookeeper

option forwardfor

#The zookeeper server list and port

server mshaik-2 check

server mshaik-3 check

server mshaik-4 check

3) Reload haproxy config file

haproxy -f /etc/haproxy.cfg -p /var/run/ -sf $(cat /var/run/

4) Test the connection through beeline

beeline> !connect jdbc:hive2://;serviceDiscoveryMode=zooKeeper;zooKeeperNamespace=hiveserver2

Connecting to jdbc:hive2://;serviceDiscoveryMode=zooKeeper;zooKeeperNamespace=hiveserver2

Enter username for jdbc:hive2://;serviceDiscoveryMode=zooKeeper;zooKeeperNamespace=hiveserver2:

Enter password for jdbc:hive2://;serviceDiscoveryMode=zooKeeper;zooKeeperNamespace=hiveserver2:

Connected to: Apache Hive (version 1.2.1000.

Driver: Hive JDBC (version 1.2.1000.


0: jdbc:hive2://>

0 Kudos
Don't have an account?
Coming from Hortonworks? Activate your account here
Version history
Revision #:
1 of 1
Last update:
‎09-27-2017 08:07 PM
Updated by:
Top Kudoed Authors