1

I am using windows machine and trying to setup hive with DbVisualizer using hive uber jar. However getting the error as mentioed below. Not sure why ? https://github.com/timveil/hive-jdbc-uber-jar

I am using following exe to generate keytab file on windows. http://web.mit.edu/KERBEROS/dist/index.html

And All the steps mentioned on the github page.

If I use user principal, I am getting following error.

dbc:hive2://aaa.corp.ad.abc:2181,bbbb.corp.ad.abc:2181,ccc.corp.ad.abc:2181/;serviceDiscoveryMode=zooKeeper;zooKeeperNamespace=hiveserver2;principal=gaurang.shah@CORP.AD.ABC

Error Message

Long Message:
Kerberos principal should have 3 parts: gaurang.shah@CORP.AD.CTC

Details:
   Type: java.lang.IllegalArgumentException

Stack Trace:
java.lang.IllegalArgumentException: Kerberos principal should have 3 parts: gaurang.shah@CORP.AD.CTC
   at org.apache.hive.service.auth.KerberosSaslHelper.getKerberosTransport(KerberosSaslHelper.java:48)
   at org.apache.hive.jdbc.HiveConnection.createBinaryTransport(HiveConnection.java:425)
   at org.apache.hive.jdbc.HiveConnection.openTransport(HiveConnection.java:202)
   at org.apache.hive.jdbc.HiveConnection.<init>(HiveConnection.java:166)
   at org.apache.hive.jdbc.HiveDriver.connect(HiveDriver.java:105)
   at sun.reflect.GeneratedMethodAccessor69.invoke(Unknown Source)
   at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
   at java.lang.reflect.Method.invoke(Unknown Source)
   at com.onseven.dbvis.g.B.D.ā(Z:1548)
   at com.onseven.dbvis.g.B.F$A.call(Z:1369)
   at java.util.concurrent.FutureTask.run(Unknown Source)
   at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
   at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
   at java.lang.Thread.run(Unknown Source)

And if I use server principal as mentioned below error is different.

dbc:hive2://aaa.corp.ad.abc:2181,bbbb.corp.ad.abc:2181,ccc.corp.ad.abc:2181/;serviceDiscoveryMode=zooKeeper;zooKeeperNamespace=hiveserver2;principal=krbgt/CORP.AD.ABC@CORP.AD.ABC

Error:

Long Message:
Could not open client transport for any of the Server URI's in ZooKeeper: GSS initiate failed

Details:
   Type: java.sql.SQLException
   SQL State: 08S01
Gaurang Shah
  • 11,764
  • 9
  • 74
  • 137
  • 1
    `principal` refers to the **Service Principal name (SPN) used by HiveServer2** => sthg like `hive/_HOST@CORP.AD.ABC` using a placeholder instead of the actual server name (since you don't know in advance which server will answer, that's the point of using ZK as directory service...) – Samson Scharfrichter Feb 07 '18 at 19:13
  • Search about server-side property `hive.server2.authentication.kerberos.principal` for context. – Samson Scharfrichter Feb 07 '18 at 19:16

1 Answers1

1

Answer provided by Samson in the comment worked for me.

using prinicpal as hive/_HOST@CORP.AD.ABC resolved the issue.

Gaurang Shah
  • 11,764
  • 9
  • 74
  • 137