DbVisualizer在使用kerberos身份验证连接到配置单元时出错

时间:2018-06-08 23:34:40

标签: hive kerberos dbvisualizer

我正在尝试使用DBVisulizer连接到hive。我正在关注下面提到的文章 https://github.com/timveil/hive-jdbc-uber-jar#kerberized-setup

以下是我的配置文件

[libdefaults]
  renew_lifetime = 7d
  forwardable = true
  default_realm = dev.abc.com
  ticket_lifetime = 24h
  dns_lookup_realm = false
  dns_lookup_kdc = false
  default_ccache_name = /tmp/krb5cc_%{uid}
  #default_tgs_enctypes = aes des3-cbc-sha1 rc4 des-cbc-md5
  #default_tkt_enctypes = aes des3-cbc-sha1 rc4 des-cbc-md5


[logging]
  default = FILE:/var/log/krb5kdc.log
  admin_server = FILE:/var/log/kadmind.log
  kdc = FILE:/var/log/krb5kdc.log


[realms]
  dev.abc.com = {
    admin_server = wplc-dc1.dev.abc.com
    kdc = wplc-dc1.dev.abc.com
  }

我已将此配置文件的路径放在 DbVisalizer设置中。

我正在使用 url

jdbc:hive2://d9lcwphd1m1.dev.abc.com:2181,d9lcwphd1m2.dev.abc.com:2181,d9lcwphd1d1.dev.abc.com:2181/;serviceDiscoveryMode=zooKeeper;zooKeeperNamespace=hiveserver2;principal=hive/_HOST@dev.abc.com

错误:

Java.sql.SQLException: Could not open client transport for any of the Server URI's in ZooKeeper: GSS initiate failed
    at org.apache.hive.jdbc.HiveConnection.openTransport(HiveConnection.java:228)
    at org.apache.hive.jdbc.HiveConnection.<init>(HiveConnection.java:166)
    at org.apache.hive.jdbc.HiveDriver.connect(HiveDriver.java:105)
    at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
    at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
    at java.base/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.base/java.util.concurrent.FutureTask.run(Unknown Source)
    at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
    at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
    at java.base/java.lang.Thread.run(Unknown Source)
Caused by: org.apache.thrift.transport.TTransportException: GSS initiate failed
    at org.apache.thrift.transport.TSaslTransport.sendAndThrowMessage(TSaslTransport.java:232)
    at org.apache.thrift.transport.TSaslTransport.open(TSaslTransport.java:316)
    at org.apache.thrift.transport.TSaslClientTransport.open(TSaslClientTransport.java:37)
    at org.apache.hadoop.hive.thrift.client.TUGIAssumingTransport$1.run(TUGIAssumingTransport.java:52)
    at org.apache.hadoop.hive.thrift.client.TUGIAssumingTransport$1.run(TUGIAssumingTransport.java:49)
    at java.base/java.security.AccessController.doPrivileged(Native Method)
    at java.base/javax.security.auth.Subject.doAs(Unknown Source)
    at org.apache.hadoop.security.UserGroupInformation.doAs(UserGroupInformation.java:1866)
    at org.apache.hadoop.hive.thrift.client.TUGIAssumingTransport.open(TUGIAssumingTransport.java:49)
    at org.apache.hive.jdbc.HiveConnection.openTransport(HiveConnection.java:204)

我认为问题是我的机器的域名是abc.com而不是dev.abc.com

klist的输出

Credentials cache: API:1CFA7C7B-9BF9-41E6-B516-BC10C925E8E7
        Principal: gaurang.shah@abc.com

  Issued                Expires               Principal
Jun  8 19:10:28 2018  Jun  9 05:10:28 2018  krbtgt/abc.com@Cabc.com

更新

如果我在配置文件中同时提供这两个域我正在解析错误。

配置。

abc.com = {
    admin_server = wpcp-dc1.abc.com
    kdc = wpcp-dc1.abc.com:88
    kdc = wpcp-dc2.abc.com:88
}
dev.abc.com = {
    admin_server = wplc-dc1.dev.abc.com
    kdc = wplc-dc1.dev.abc.com
  }

错误:

Long Message:
Can't get Kerberos realm

Details:
   Type: java.lang.IllegalArgumentException

Stack Trace:
KrbException: Illegal config content:  }
   at java.security.jgss/sun.security.krb5.Config.parseStanzaTable(Unknown Source)
   at java.security.jgss/sun.security.krb5.Config.<init>(Unknown Source)
   at java.security.jgss/sun.security.krb5.Config.getInstance(Unknown Source)

0 个答案:

没有答案