When an EMR cluster has multiple HiveServer2 services, load balancing for HiveServer2 can be achieved using the ZooKeeper service. This document provides a detailed introduction to using HiveServer2 load balancing.
Development Preparation
Make sure you have activated Tencent Cloud and created an EMR cluster. For more details, see Creating a Cluster. Create a High Availability Hadoop default scene cluster, and select the Hive component in the software configuration interface.
Achieving HiveServer2 Load Balancing through ZooKeeper
The high-availability cluster in the default Hadoop scene has ZooKeeper service installed by default. You can use the following connection method to connect to HiveServer2, leveraging ZooKeeper to achieve load balancing:
beeline -u 'jdbc:hive2://${hive.zookeeper.quorum}/;serviceDiscoveryMode=zooKeeper;zooKeeperNamespace=<hive.server2.zookeeper.namespace>' -n ${user} -p ${password}
Note:
1. ${hive.zookeeper.quorum} and ${hive.server2.zookeeper.namespace} are related configurations for ZooKeeper Server in Hive. You can find the corresponding values of the hive.zookeeper.quorum and hive.server2.zookeeper.namespace parameters in the hive-site.xml configuration file under EMR console Cluster Services > HIVE > Configuration Management. 2. user and password refer to the LDAP username and login password you set.
Was this page helpful?