Community Articles

Find and share helpful community-sourced technical articles.
Labels (2)
avatar
Cloudera Employee

At times in a CDH/CDP cluster, users may have multiple HS2 mapped under a load balancer to achieve high availability and user connection load balancing.

However, for scenarios like separating high-priority jobs, dedicated queue/HS2 requirement for a business unit, dedicated resource allocation, etc., users may have a dedicated HS2 in their cluster. 

Below are two methods to create and connect to a dedicated Hive HS2 using ZooKeeper details:

Method 1: Connect using HS2 instance hostname/IP.

  1. Add an instance with an HS2 role on it.
  2. Ensure that this HS2 is not part of your load balancer, in case you want to keep it separate for certain jobs. But this is optional.
  3. To connect to this dedicated HS2 use the below beeline command:
    beeline> !connect jdbc:hive2://<serverName>:10000/default;​

 

 

Method 2: Connect using Zookeeper instance details.

  1. Go to Hive_on Tez service > Instances. Add a new HS2 instance.
  2. Click on the "Role Groups" option on the top right side of the instance list.
  3. Click on "Create Role Group". Give name as "Dedicated HS2". Role type: "HiveServer2" and Copy From: "HiveServer2 Default Group".
  4. Select "HiveServer2 Default Group" from the left side menu, select the dedicated HS2 host select "Move Selected Instances To Group" and choose "Dedicated HS2" role group.
  5. After this on the instance page, you will see the dedicated HS2 host reflecting under the "Dedicated HS2" role group.
  6. Now, on the instance page click on the "HiveServer2" hyperlink of your dedicated HS2. Click on Configurations.
  7. Under Dedicated HS2 > Configurations > Advanced > HiveServer2 Advanced Configuration Snippet (Safety Valve) for hive-site.xml.
  8. Add the below parameters and save it. 
    Name: hive.server2.zookeeper.namespace
    Value: dedicatedhs2​
  9. Restart the dedicated HS2 to apply the changes.
  10. Now, to connect to this dedicated HS2 via beeline using Zookeeper details, you need to mention "zooKeeperNamespace=dedicatedhs2" in your beeline string instead of "zooKeeperNamespace=hiveserver2". 
    Syntax example: 
    beeline -u "jdbc:hive2://<Zk1>:2181,<Zk2>:2181,<Zk3>:2181/;serviceDiscoveryMode=zooKeeper;zooKeeperNamespace=dedicatedhs2"​

 

 

DISCLAIMER: An external user contributed to this article. Cloudera may not verify that the steps may be applicable for all use cases and may be very specific to a particular distribution. Please follow with caution and at your own risk. If needed, raise a support case to get confirmation.

631 Views
0 Kudos