gpt4 book ai didi

java - 使用 keytab 文件连接到 Impala 的 jdbc URL

转载 作者:行者123 更新时间:2023-11-30 05:28:52 28 4
gpt4 key购买 nike

我正在尝试使用 keytab 文件连接到 Impala,但我没有找到与 keytab 连接的确切 URL。我已经经历过Cloudera documentation ,但它没有提到使用带有主体的 keytab 文件来连接到 Impala。使用 keytab 文件连接到 Impala 的 JDBC URL 是什么?

最佳答案

User Guide 中所述,“使用 Kerberos”一节,Impala JDBC 驱动程序支持三种获取 Kerberos 主题的方法:

  1. ...The driver tries to obtain the Subject from the current thread's inherited AccessControlContext. If the AccessControlContext contains multiple Subjects, the driver uses the most recent Subject.
  2. The driver checks the java.security.auth.login.config system property for a JAAS configuration. If a JAAS configuration is specified, the driver uses that information to create a LoginContext and then uses the Subject associated with it.
  3. The driver checks the KRB5_CONFIG and KRB5CCNAME system environment variables for a Kerberos ticket cache. The driver uses the information from the cache to create a LoginContext and then uses the Subject associated with it.

您可以通过 KrbAuthType 控制驱动程序将使用哪种方法连接 URL 中的参数,否则它将一一尝试每种方法。

所以,使用 keytab 文件(方法#2)你应该做的就是

  1. 创建 jaas.conf指定 key 表位置、主体等的文件。
  2. 设置系统属性 java.security.auth.login.config在你的程序中(或使用JVM 启动参数 -Djava.security.auth.login.config=</some-path-to/jaas.conf> )指向 jaas.conf 的位置,并且
  3. 在 JDBC 连接 URL 中,设置 ...AuthMech=1; KrbRealm=<YOUR-REALM.COM>;KrbHostFQDN=your.impalad.host.com;KrbServiceName=<impala-service-principal>用于 Kerberos 身份验证

...在尝试连接之前。

或者,kinit使用您的 key 表,以便票证缓存在调用您的 Java 应用程序之前包含必要的 TGT(本质上,使用上面的方法 3)。

关于java - 使用 keytab 文件连接到 Impala 的 jdbc URL,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/57990068/

28 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com