Community Articles
Find and share helpful community-sourced technical articles
Announcements
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 0.0.0.0:80

#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 172.26.81.203:2181 check

server mshaik-3 172.26.81.204:2181 check

server mshaik-4 172.26.81.206:2181 check

3) Reload haproxy config file

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

4) Test the connection through beeline

beeline> !connect jdbc:hive2://mshaik-1.htworks.com:80/;serviceDiscoveryMode=zooKeeper;zooKeeperNamespace=hiveserver2

Connecting to jdbc:hive2://mshaik-1.htworks.com:80/;serviceDiscoveryMode=zooKeeper;zooKeeperNamespace=hiveserver2

Enter username for jdbc:hive2://mshaik-1.htworks.com:80/;serviceDiscoveryMode=zooKeeper;zooKeeperNamespace=hiveserver2:

Enter password for jdbc:hive2://mshaik-1.htworks.com:80/;serviceDiscoveryMode=zooKeeper;zooKeeperNamespace=hiveserver2:

Connected to: Apache Hive (version 1.2.1000.2.5.5.5-2)

Driver: Hive JDBC (version 1.2.1000.2.5.5.0-157)

Transaction isolation: TRANSACTION_REPEATABLE_READ

0: jdbc:hive2://mshaik-1.htworks.com:80/>

2,688 Views
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:
 
Contributors
Top Kudoed Authors