How to install a Beeline Client to connect to Hive Metastore
Fig.1. Remote Metastore Architecture
The Hive metastore service stores the metadata for Hive tables and partitions in a relational database, and provides Hive access to this information using the metastore service API. Hevo Data Lake uses Hive tables to store data. Hive metastore service runs in its own JVM process. HiverServer2, HCatalog, Impala, and other processes communicate with it using the Thrift network API. The metastore service communicates with the metastore database over JDBC. Our Hive metastore service runs in the Remote mode which provides better availability and scalability. Beeline is a JDBC client based on SQLLine CLI. It connects to HiveServer2 to access the metastore database.
In this article, we’ll check how to connect to Hive using Beeline client.
1 Download Hadoop dependency specifically version 2.5.1
2 Download Hive dependency specifically version 1.2.1
3 Extract both tar files.
tar -xvzf hadoop-2.5.1.tar.gz tar -xvzf apache-hive-1.2.1-bin.tar.gz
.bashrc file by exporting the dependency
export HADOOP_HOME=/path/to/hadoop-2.5.1 export HIVE_HOME=/path/to/apache-hive-1.2.1-bin PATH=$PATH:$HIVE_HOME/bin
beeline client using below command
Note: The command line option
—-incremental=true is optional, but will extend the amount of time that you can remain idle and not have your connection dropped.
6 Connect to the JDBC server from the beeline client. You can find the host-address in the Hevo Destination Config.
Some other helpful commands
- Reconnect to the inactive session
- Quitting Beeline Client
- Queries You can run SQL commands to do some basic operations here. Don’t forget to put semicolons to end the SQL commands.
/* to list out all the databases */ SHOW DATABASES; /* to list our all the tables */ SHOW TABLES IN <database-name>; /* to drop database */ DROP DATABASE <database-name>;
For more information on HiveServer2 Clients, you can always check out this.