【问题标题】:oozie-hive beeline not working with kerberosoozie-hive 直线不适用于 kerberos
【发布时间】:2019-07-29 08:28:52
【问题描述】:

我们最近从旧的 HDP 集群(没有 kerberos)迁移到了新的 HDP 集群(有 kerberos)。在新集群上运行我们的 ozzie 作业时,我们面临一些身份验证问题。请参考下面的 workflow.xml。第一个动作“hive-101”工作正常,但第二个动作 hive-102 失败。

<credentials>
    <credential name="hs2-creds" type="hive2">
        <property>
            <name>hive2.server.principal</name>
            <value>${jdbcPrincipal}</value>
        </property>
        <property>
            <name>hive2.jdbc.url</name>
            <value>${jdbcURL}</value>
        </property>
    </credential>
</credentials>

<start to="hive-101"/>

<action name="hive-101" cred="hs2-creds">
    <hive2 xmlns="uri:oozie:hive2-action:0.2">
        <jdbc-url>${jdbcURL}</jdbc-url>
        <password>${hivepassword}</password>
          <query>SELECT count(*)  FROM table1;</query>
    </hive2>
    <ok to="hive-102"/>
    <error to="fail"/>
</action>


<action name="hive-102" retry-max="${maxretry}" retry-interval="${retryinterval}">
    <shell xmlns="uri:oozie:shell-action:0.3">
        <exec>beeline</exec>
        <argument>jdbc:hive2://zk01.abc.com:2181,zk02.abc.com:2181,zk03.abc.com:2181/${hivedatabase};principal=hive/_HOST@ABC.COM;serviceDiscoveryMode=zooKeeper;zooKeeperNamespace=hiveserver2</argument>
        <argument>--outputformat=vertical</argument>
        <argument>--silent=true</argument>
        <argument>-e</argument>
        <argument>
            SELECT max(id) as mx_id FROM ${hivedatabase}.table1;

        </argument>
        <capture-output/>
    </shell>
    <ok to="end"/>
    <error to="fail"/>
</action>

以下是错误详情

ERROR transport.TSaslTransport: SASL negotiation failure
javax.security.sasl.SaslException: GSS initiate failed
at com.sun.security.sasl.gsskerb.GssKrb5Client.evaluateChallenge(GssKrb5Client.java:211) ~[?:1.8.0_212]

Caused by: org.ietf.jgss.GSSException: No valid credentials provided (Mechanism level: Failed to find any Kerberos tgt)
at sun.security.jgss.krb5.Krb5InitCredential.getInstance(Krb5InitCredential.java:147) ~[?:1.8.0_212]
at sun.security.jgss.krb5.Krb5MechFactory.getCredentialElement(Krb5MechFactory.java:122) ~[?:1.8.0_212]

WARN jdbc.HiveConnection: Failed to connect to nn02.abc.com:10000
WARN jdbc.HiveConnection: Could not open client transport with JDBC Uri: jdbc:hive2://nn02.abc.com:10000/db_test;principal=hive/_HOST@ABC.COM;serviceDiscoveryMode=zooKeeper;zooKeeperNamespace=hiveserver2: GSS initiate failed Retrying 0 of 1
ERROR transport.TSaslTransport: SASL negotiation failure
javax.security.sasl.SaslException: GSS initiate failed
at com.sun.security.sasl.gsskerb.GssKrb5Client.evaluateChallenge(GssKrb5Client.java:211) ~[?:1.8.0_212]

Caused by: org.ietf.jgss.GSSException: No valid credentials provided (Mechanism level: Failed to find any Kerberos tgt)
at sun.security.jgss.krb5.Krb5InitCredential.getInstance(Krb5InitCredential.java:147) ~[?:1.8.0_212]

【问题讨论】:

    标签: kerberos oozie


    【解决方案1】:

    shell 操作将以启动 Oozie 工作流的 Unix 用户身份在任意数据节点上运行。尝试运行 shell 命令的用户不会自动通过 Kerberos 进行身份验证。

    我相信您必须在每个数据节点上为用户放置一个 Kerberos 密钥表。然后,您的 Oozie shell 操作将需要运行一个脚本,该脚本使用 keytab 运行 kinit,然后运行 ​​beeline 命令。

    来自 Mohammad Kamrul Islam 和 Aravind Srinivasan 的 Apache Oozie

    在不安全的 Hadoop 集群上,shell 命令将以运行 TaskTracker (Hadoop 1) 或 YARN 容器 (Hadoop 2) 的 Unix 用户身份执行。这通常是系统定义的用户。在运行 Kerberos 的安全 Hadoop 集群上,shell 命令将以提交包含操作的工作流的 Unix 用户身份运行。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2017-03-24
      • 2019-06-29
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2014-06-30
      • 1970-01-01
      相关资源
      最近更新 更多