• Skip to primary navigation
  • Skip to main content
  • Skip to primary sidebar
  • Skip to footer navigation

The Geek Diary

  • OS
    • Linux
    • CentOS/RHEL
    • Solaris
    • Oracle Linux
    • VCS
  • Interview Questions
  • Database
    • oracle
    • oracle 12c
    • ASM
    • mysql
    • MariaDB
  • DevOps
    • Docker
    • Shell Scripting
  • Big Data
    • Hadoop
    • Cloudera
    • Hortonworks HDP

HDPCA Exam Objective – Configure HiveServer2 HA ( Part 2 – Configure HA )

by admin

Note: This is post is part of the HDPCA exam objective series

Hive first started with HiveServer1. However, this version of the Hive server was not very stable. It sometimes suspended or blocked clients’ connection quietly. Since version 11, Hive includes a new Hive server called HiveSever2 as an addition to HiveServer1. HiveServer2 is an enhanced Hive server designed for multiclient concurrency and improved authentication. HiveServer2 also supports Beeline as the alternative command-line interface. HiveServer1 is deprecated and removed from Hive since version 1.0.0.

In the last post, we have seen how to install and configure a Standalone HiveServer Service using Ambari. In this post, we will see how to configure the High Availability for HiveServer (HiveServer2).

Configuring HiveServer2 HA

1. To configure HiveServer2 HA, goto Services > Hive and click “Add HiveServer2” under Service Actions.

configuring HiveServer2 HA HDPCA exam objective

2. Confirm the host to add the HiveServer2 Component and click “Confirm Add”.

confirm the host to add HiveServer2 component

3. Once installed, HiveServer2 needs to be started manually. Go to the Hive Service page and click on the Stopped HiveServer2 host.

start HiveServer2 manually after installing

4. Start the HiveServer2 from the drop-down menu.

starting HiveServer2 HDPCA exam

5. Once started you can verify the same in the Hive Service page.

confirm HiveServer2 start HDPCA

Configuring Hive Metastore HA

Along with HiveServer2 HA, we can also configure the High availability for Hive Metastore. Follow the steps outlined below to configure Hive Metastore HA.

1. Goto the Services > Hive page and click “Add Hive Metastore” under “Service Actions” drop-down.

Add Hive Metastore using Ambari

2. The wizard will ask to select the host to add Hive Metastore component. It will also provide some recommended property changes to be done in order to add the new component.

select host for Hive Metastore addition using ambari

3. Post installation, we need to start the Hive Metastore manually. Along with this, we need to restart few services like HDFS, YARN, Hive etc to complete the Hive Metastore addition. Click the Stopped Hive Metastore to go to the Hive Metastore host page.

start Hive Metastore Manually after installation

4. On the host page, start the Hive Metastore manually as shown below.

start HIve Metastore from host page in Ambari

5. Verify all the service along with Hive Components.

Verify HiveServer2 Service components in Ambari

Connecting the Hive database

Let’s connect to the Hive databases and perform some queries. In order to connect the Hive Database, we need to have the HiveServer2 JDBC URL. It can be obtained from the ambari as shown below. Goto the Hive Service Page and copy the JDBC URL from the page.

Getting the HiveServer2 JDBC URL from Ambari

We can connect to the Hive database using “hive” user as it has all privileges on all database objects by default. To connect to the Hive database we need to use the command “beeline“.

# beeline
Beeline version 1.2.1000.2.6.5.0-292 by Apache Hive
beeline> !connect [HiveServer2 JDBC URL]

connect a Hive database - Configuring HiveServer2 HA HDPCA exam objective

The username password used to connect hive database is “hive/hive”. The Hive queries works almost like mysql queries. To list available databases in hive, use the query:

0: jdbc:hive2://dn2.localdomain:2181,dn1.loca> show databases;
+----------------+--+
| database_name  |
+----------------+--+
| default        |
+----------------+--+
1 row selected (1.14 seconds)

Similar to MySQL, to create any object or query any object under the database, we need to first use the “use [database]” query.

0: jdbc:hive2://dn2.localdomain:2181,dn1.loca> use default;
No rows affected (0.551 seconds)

To list all the tables under the database “default”, use the below query:

0: jdbc:hive2://dn2.localdomain:2181,dn1.loca> show tables;
+-------------+--+
|  tab_name   |
+-------------+--+
| test_table  |
+-------------+--+
1 row selected (0.561 seconds)
HDPCA Exam Objective – Configure HiveServer2 HA ( Part 1 – Installing HiveServer )
How to Configure Hive Authorization Using Apache Ranger

Filed Under: Hadoop, HDPCA, Hortonworks HDP

Some more articles you might also be interested in …

  1. HDPCA Exam Objective – View an application’s log file (Troubleshoot a failed job)
  2. HDPCA Exam Objective – Recover a snapshot
  3. HDPCA Practice Exam Questions and AWS Instance Setup Details
  4. HDPCA Exam Objective – Install ambari agent
  5. HDPCA Exam Objective – Configure NameNode HA
  6. HDPCA Exam Objective – Create a snapshot of an HDFS directory
  7. How to run Hadoop without using SSH
  8. HDPCA Exam Objective – Configure HDFS ACLs
  9. HDPCA Exam Objective – Configure the Capacity Scheduler
  10. HDPCA Exam Objective – Configure HiveServer2 HA ( Part 1 – Installing HiveServer )

You May Also Like

Primary Sidebar

Recent Posts

  • powertop Command Examples in Linux
  • powertop: command not found
  • powerstat: command not found
  • powerstat Command Examples in Linux

© 2023 · The Geek Diary

  • Archives
  • Contact Us
  • Copyright