Connecting to Hive via Beeline using Kerberos keytab

malughanshyam picture malughanshyam · Jul 3, 2015 · Viewed 25.6k times · Source

Is it possible to connect to Hive via beeline using (kerberos) keytab file similar to the approach used for JDBC at

https://cwiki.apache.org/confluence/display/Hive/HiveServer2+Clients#HiveServer2Clients-UsingKerberoswithaPre-AuthenticatedSubject

PS : beeline does support connecting on a kerberos secured hive server with username and password. But I am looking for a way to connect it with a keytab file. http://doc.mapr.com/display/MapR40x/Configuring+Hive+on+a+Secure+Cluster#ConfiguringHiveonaSecureCluster-UsingBeelinewithKerberos

Answer

Kumar picture Kumar · Jul 3, 2015

I think you cannot connect with keytab file into beeline but you can get ticket with keytab using kinit and then pass the hive server principal with the jdbc connection string of beeline to connect.

kinit -k -t keytab principal

Connection string to connect with beeline

!connect jdbc:hive2://hostname:10000/default;principal=hive/_HOST@REALM