Skip to content

Impala JDBC connection with Kerberos

Impala JDBC connection with Kerberos

The idea was to use Java locally (in my case with InteliJ) to connect to Hive metastore through Impala. That was in order to read some data and then be able to use them by some other processes on later stages. Hadoop cluster that I was connecting to was Kerberised, which made the exercise more tricky. Here’s how I managed to establish such a connection.

 

HOW TO

I was using InteliJ Community Edition 2019.2.3 and cluster with CDH 6.1.1 with Kerberos.

In order to connect to the Hadoop cluster, at first I had to obtain a Kerberos ticket. I used kinit for that:

After providing the password, I checked that my ticket was created:

You should be seeing something like this:

You may also obtain your ticket from the keytab in order not to manually type password each time:

Additionally I needed the krb5.conf file, which I downloaded from the cluster. It was in /etc/krb5.conf location in this case.

 

Then I had to get the Impala JDBC driver. I found it here.

With those pieces I was able to connect and list/access all the tables available in my metastore.

Here’s my code:

 

In pom.xml I only needed to attach hive-jdbc.jar. This is how it looked like:

And that was it. You can apply more complex queries to your tables or redirect the data to some other place.

0

Leave a Reply

Your email address will not be published. Required fields are marked *