FAQ
Repository: hive
Updated Branches:
   refs/heads/branch-2.0 b2b61da4e -> c66c7cb28
   refs/heads/master fee6669c1 -> b543e1e88


HIVE-13428 : ZK SM in LLAP should have unique paths per cluster (Sergey Shelukhin, reviewed by Siddharth Seth)


Project: http://git-wip-us.apache.org/repos/asf/hive/repo
Commit: http://git-wip-us.apache.org/repos/asf/hive/commit/b543e1e8
Tree: http://git-wip-us.apache.org/repos/asf/hive/tree/b543e1e8
Diff: http://git-wip-us.apache.org/repos/asf/hive/diff/b543e1e8

Branch: refs/heads/master
Commit: b543e1e881f2dd72aed8c1dd07fa6e07a1f3c2b7
Parents: fee6669
Author: Sergey Shelukhin <sershe@apache.org>
Authored: Fri Apr 8 11:34:47 2016 -0700
Committer: Sergey Shelukhin <sershe@apache.org>
Committed: Fri Apr 8 11:34:47 2016 -0700

----------------------------------------------------------------------
  .../hadoop/hive/llap/security/SecretManager.java | 18 +++++++++++++++++-
  1 file changed, 17 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/hive/blob/b543e1e8/llap-server/src/java/org/apache/hadoop/hive/llap/security/SecretManager.java
----------------------------------------------------------------------
diff --git a/llap-server/src/java/org/apache/hadoop/hive/llap/security/SecretManager.java b/llap-server/src/java/org/apache/hadoop/hive/llap/security/SecretManager.java
index bbdca7b..8c7a539 100644
--- a/llap-server/src/java/org/apache/hadoop/hive/llap/security/SecretManager.java
+++ b/llap-server/src/java/org/apache/hadoop/hive/llap/security/SecretManager.java
@@ -18,6 +18,7 @@ import java.io.DataInputStream;
  import java.io.IOException;
  import java.security.PrivilegedAction;
  import java.util.concurrent.TimeUnit;
+import java.util.regex.Pattern;

  import org.apache.hadoop.conf.Configuration;
  import org.apache.hadoop.hive.conf.HiveConf;
@@ -81,6 +82,14 @@ public class SecretManager extends ZKDelegationTokenSecretManager<LlapTokenIdent
      return id;
    }

+ private final static Pattern hostsRe = Pattern.compile("[^A-Za-z0-9_-]");
+ private static String deriveZkPath(Configuration conf) throws IOException {
+ String hosts = HiveConf.getTrimmedVar(conf, ConfVars.LLAP_DAEMON_SERVICE_HOSTS);
+ String clusterName = hosts.startsWith("@") ? hosts.substring(1) : hosts;
+ String userName = UserGroupInformation.getCurrentUser().getShortUserName();
+ return hostsRe.matcher(userName + "_" + clusterName).replaceAll("_") ;
+ }
+
    public static SecretManager createSecretManager(
        final Configuration conf, String llapPrincipal, String llapKeytab) {
      // Create ZK connection under a separate ugi (if specified) - ZK works in mysterious ways.
@@ -101,7 +110,14 @@ public class SecretManager extends ZKDelegationTokenSecretManager<LlapTokenIdent
      zkConf.setLong(DelegationTokenManager.RENEW_INTERVAL, tokenLifetime);
      zkConf.set(SecretManager.ZK_DTSM_ZK_KERBEROS_PRINCIPAL, principal);
      zkConf.set(SecretManager.ZK_DTSM_ZK_KERBEROS_KEYTAB, keyTab);
- setZkConfIfNotSet(zkConf, SecretManager.ZK_DTSM_ZNODE_WORKING_PATH, "llapzkdtsm");
+ String zkPath;
+ try {
+ zkPath = deriveZkPath(conf);
+ } catch (IOException e) {
+ throw new RuntimeException(e);
+ }
+ LOG.info("Using {} as ZK secret manager path", zkPath);
+ zkConf.set(SecretManager.ZK_DTSM_ZNODE_WORKING_PATH, "zkdtsm_" + zkPath);
      setZkConfIfNotSet(zkConf, SecretManager.ZK_DTSM_ZK_AUTH_TYPE, "sasl");
      setZkConfIfNotSet(zkConf, SecretManager.ZK_DTSM_ZK_CONNECTION_STRING,
          HiveConf.getVar(zkConf, ConfVars.LLAP_ZKSM_ZK_CONNECTION_STRING));

Search Discussions

  • Sershe at Apr 8, 2016 at 6:53 pm
    HIVE-13428 : ZK SM in LLAP should have unique paths per cluster (Sergey Shelukhin, reviewed by Siddharth Seth)


    Project: http://git-wip-us.apache.org/repos/asf/hive/repo
    Commit: http://git-wip-us.apache.org/repos/asf/hive/commit/c66c7cb2
    Tree: http://git-wip-us.apache.org/repos/asf/hive/tree/c66c7cb2
    Diff: http://git-wip-us.apache.org/repos/asf/hive/diff/c66c7cb2

    Branch: refs/heads/branch-2.0
    Commit: c66c7cb28011c2152e4949433d831aff6c121529
    Parents: b2b61da
    Author: Sergey Shelukhin <sershe@apache.org>
    Authored: Fri Apr 8 11:34:47 2016 -0700
    Committer: Sergey Shelukhin <sershe@apache.org>
    Committed: Fri Apr 8 11:53:23 2016 -0700

    ----------------------------------------------------------------------
      .../hadoop/hive/llap/security/SecretManager.java | 18 +++++++++++++++++-
      1 file changed, 17 insertions(+), 1 deletion(-)
    ----------------------------------------------------------------------


    http://git-wip-us.apache.org/repos/asf/hive/blob/c66c7cb2/llap-server/src/java/org/apache/hadoop/hive/llap/security/SecretManager.java
    ----------------------------------------------------------------------
    diff --git a/llap-server/src/java/org/apache/hadoop/hive/llap/security/SecretManager.java b/llap-server/src/java/org/apache/hadoop/hive/llap/security/SecretManager.java
    index bbdca7b..8c7a539 100644
    --- a/llap-server/src/java/org/apache/hadoop/hive/llap/security/SecretManager.java
    +++ b/llap-server/src/java/org/apache/hadoop/hive/llap/security/SecretManager.java
    @@ -18,6 +18,7 @@ import java.io.DataInputStream;
      import java.io.IOException;
      import java.security.PrivilegedAction;
      import java.util.concurrent.TimeUnit;
    +import java.util.regex.Pattern;

      import org.apache.hadoop.conf.Configuration;
      import org.apache.hadoop.hive.conf.HiveConf;
    @@ -81,6 +82,14 @@ public class SecretManager extends ZKDelegationTokenSecretManager<LlapTokenIdent
          return id;
        }

    + private final static Pattern hostsRe = Pattern.compile("[^A-Za-z0-9_-]");
    + private static String deriveZkPath(Configuration conf) throws IOException {
    + String hosts = HiveConf.getTrimmedVar(conf, ConfVars.LLAP_DAEMON_SERVICE_HOSTS);
    + String clusterName = hosts.startsWith("@") ? hosts.substring(1) : hosts;
    + String userName = UserGroupInformation.getCurrentUser().getShortUserName();
    + return hostsRe.matcher(userName + "_" + clusterName).replaceAll("_") ;
    + }
    +
        public static SecretManager createSecretManager(
            final Configuration conf, String llapPrincipal, String llapKeytab) {
          // Create ZK connection under a separate ugi (if specified) - ZK works in mysterious ways.
    @@ -101,7 +110,14 @@ public class SecretManager extends ZKDelegationTokenSecretManager<LlapTokenIdent
          zkConf.setLong(DelegationTokenManager.RENEW_INTERVAL, tokenLifetime);
          zkConf.set(SecretManager.ZK_DTSM_ZK_KERBEROS_PRINCIPAL, principal);
          zkConf.set(SecretManager.ZK_DTSM_ZK_KERBEROS_KEYTAB, keyTab);
    - setZkConfIfNotSet(zkConf, SecretManager.ZK_DTSM_ZNODE_WORKING_PATH, "llapzkdtsm");
    + String zkPath;
    + try {
    + zkPath = deriveZkPath(conf);
    + } catch (IOException e) {
    + throw new RuntimeException(e);
    + }
    + LOG.info("Using {} as ZK secret manager path", zkPath);
    + zkConf.set(SecretManager.ZK_DTSM_ZNODE_WORKING_PATH, "zkdtsm_" + zkPath);
          setZkConfIfNotSet(zkConf, SecretManager.ZK_DTSM_ZK_AUTH_TYPE, "sasl");
          setZkConfIfNotSet(zkConf, SecretManager.ZK_DTSM_ZK_CONNECTION_STRING,
              HiveConf.getVar(zkConf, ConfVars.LLAP_ZKSM_ZK_CONNECTION_STRING));

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
groupcommits @
categorieshive, hadoop
postedApr 8, '16 at 6:53p
activeApr 8, '16 at 6:53p
posts2
users1
websitehive.apache.org

1 user in discussion

Sershe: 2 posts

People

Translate

site design / logo © 2021 Grokbase