[ 
https://issues.apache.org/jira/browse/GOBBLIN-1061?focusedWorklogId=500393&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-500393
 ]

ASF GitHub Bot logged work on GOBBLIN-1061:
-------------------------------------------

                Author: ASF GitHub Bot
            Created on: 14/Oct/20 02:53
            Start Date: 14/Oct/20 02:53
    Worklog Time Spent: 10m 
      Work Description: jack-moseley commented on a change in pull request 
#3124:
URL: https://github.com/apache/incubator-gobblin/pull/3124#discussion_r504369391



##########
File path: 
gobblin-runtime/src/main/java/org/apache/gobblin/runtime/util/HelixLeaderUtils.java
##########
@@ -0,0 +1,96 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.gobblin.runtime.util;
+
+import java.net.InetAddress;
+import java.net.UnknownHostException;
+
+import org.apache.helix.HelixManager;
+import org.apache.helix.PropertyKey;
+import org.apache.helix.model.LiveInstance;
+
+import com.google.common.base.Optional;
+import com.google.common.collect.ImmutableMap;
+import com.linkedin.data.DataMap;
+import com.linkedin.restli.common.HttpStatus;
+import com.linkedin.restli.server.RestLiServiceException;
+import com.typesafe.config.Config;
+
+import lombok.extern.slf4j.Slf4j;
+
+import org.apache.gobblin.service.ServiceConfigKeys;
+import org.apache.gobblin.util.ConfigUtils;
+
+
+/**
+ * Utils for storing/parsing helix URL in the helix instance name
+ */
+@Slf4j
+public class HelixLeaderUtils {
+  public static String HELIX_INSTANCE_NAME_SEPARATOR = "@";
+
+  /**
+   */
+  private static String getUrlFromHelixInstanceName(String helixInstanceName) {
+    if (!helixInstanceName.contains(HELIX_INSTANCE_NAME_SEPARATOR)) {
+      return null;
+    } else {
+      return 
helixInstanceName.substring(helixInstanceName.indexOf(HELIX_INSTANCE_NAME_SEPARATOR)
 + 1);
+    }
+  }
+
+  private static String getLeaderUrl(HelixManager helixManager) {
+    PropertyKey key = 
helixManager.getHelixDataAccessor().keyBuilder().controllerLeader();
+    LiveInstance leader = helixManager.getHelixDataAccessor().getProperty(key);
+    return getUrlFromHelixInstanceName(leader.getInstanceName());
+  }
+
+  /**
+   * If this host is not the leader, throw a {@link RestLiServiceException}, 
and include the URL of the leader host in
+   * the message and in the errorDetails under the key {@link 
ServiceConfigKeys#LEADER_URL}.
+   */
+  public static void throwErrorIfNotLeader(Optional<HelixManager> 
helixManager)  {
+    if (helixManager.isPresent() && !helixManager.get().isLeader()) {
+      String leaderUrl = getLeaderUrl(helixManager.get());
+      if (leaderUrl == null) {
+        return;
+      }
+      RestLiServiceException exception = new 
RestLiServiceException(HttpStatus.S_400_BAD_REQUEST, "Request must be sent to 
leader node at URL " + leaderUrl);
+      exception.setErrorDetails(new 
DataMap(ImmutableMap.of(ServiceConfigKeys.LEADER_URL, leaderUrl)));
+      throw exception;
+    }
+  }
+
+  /**
+   * Build helix instance name by getting {@link 
org.apache.gobblin.service.ServiceConfigKeys#HELIX_INSTANCE_NAME_KEY}
+   * and appending the host, port, and service name with a separator
+   */
+  public static String buildHelixInstanceName(Config config, String 
defaultInstanceName) {
+    String helixInstanceName = ConfigUtils.getString(config, 
ServiceConfigKeys.HELIX_INSTANCE_NAME_KEY, defaultInstanceName);
+
+    String url = "";
+    try {
+      url = HELIX_INSTANCE_NAME_SEPARATOR + "https://"; + 
InetAddress.getLocalHost().getHostName() + ":" + ConfigUtils.getString(config, 
ServiceConfigKeys.SERVICE_PORT, "")

Review comment:
       Added a config for this and default to https://




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
[email protected]


Issue Time Tracking
-------------------

    Worklog Id:     (was: 500393)
    Time Spent: 1h 40m  (was: 1.5h)

> Kafka consumer Kerberos config
> ------------------------------
>
>                 Key: GOBBLIN-1061
>                 URL: https://issues.apache.org/jira/browse/GOBBLIN-1061
>             Project: Apache Gobblin
>          Issue Type: Bug
>    Affects Versions: 0.15.0
>         Environment: OS RHEL 7.5, Cloudera kafka 3.1.0 (kafka 1.0.1), CDH 
> 5.16.2
>            Reporter: Jan Tichý
>            Priority: Blocker
>         Attachments: application.conf, sip_voice_raw.pull
>
>          Time Spent: 1h 40m
>  Remaining Estimate: 0h
>
> Does the gobblin support kerberos auth for kafka client consumer? I have 
> right kafka consumer settings with sasl_plaintext configuration but if it 
> tries to kinit it fails with exception below:
> {code:java}
> 2020-02-20 05:44:00 PST INFO [DefaultQuartzScheduler_Worker-1] 
> org.apache.kafka.common.config.AbstractConfig - ConsumerConfig values:
> metric.reporters = []
> metadata.max.age.ms = 300000
> value.deserializer = class 
> io.confluent.kafka.serializers.KafkaAvroDeserializer
> group.id = kafka09
> partition.assignment.strategy = 
> [org.apache.kafka.clients.consumer.RangeAssignor]
> reconnect.backoff.ms = 50
> sasl.kerberos.ticket.renew.window.factor = 0.8
> max.partition.fetch.bytes = 1048576
> bootstrap.servers = [czrtim1hr.oskarmobil.cz:9092, 
> czrtim2hr.oskarmobil.cz:9092]
> retry.backoff.ms = 100
> sasl.kerberos.kinit.cmd = /usr/bin/kinit
> sasl.kerberos.service.name = kafka
> sasl.kerberos.ticket.renew.jitter = 0.05
> ssl.keystore.type = JKS
> ssl.trustmanager.algorithm = PKIX
> enable.auto.commit = false
> ssl.key.password = null
> fetch.max.wait.ms = 500
> sasl.kerberos.min.time.before.relogin = 60000
> connections.max.idle.ms = 540000
> ssl.truststore.password = null
> session.timeout.ms = 30000
> metrics.num.samples = 2
> client.id =
> ssl.endpoint.identification.algorithm = null
> key.deserializer = class io.confluent.kafka.serializers.KafkaAvroDeserializer
> ssl.protocol = TLS
> check.crcs = true
> request.timeout.ms = 40000
> ssl.provider = null
> ssl.enabled.protocols = [TLSv1.2, TLSv1.1, TLSv1]
> ssl.keystore.location = null
> heartbeat.interval.ms = 3000
> auto.commit.interval.ms = 5000
> receive.buffer.bytes = 32768
> ssl.cipher.suites = null
> ssl.truststore.type = JKS
> security.protocol = SASL_PLAINTEXT
> ssl.truststore.location = null
> ssl.keystore.password = null
> ssl.keymanager.algorithm = SunX509
> metrics.sample.window.ms = 30000
> fetch.min.bytes = 1
> send.buffer.bytes = 131072
> auto.offset.reset = latest2020-02-20 05:44:00 PST ERROR 
> [DefaultQuartzScheduler_Worker-1] org.apache.gobblin.runtime.SourceDecorator 
> - Failed to get work units for job job_SipVoiceRaw_1582206240042
> org.apache.kafka.common.KafkaException: Failed to construct kafka consumer
> at 
> org.apache.kafka.clients.consumer.KafkaConsumer.<init>(KafkaConsumer.java:648)
> at 
> org.apache.kafka.clients.consumer.KafkaConsumer.<init>(KafkaConsumer.java:542)
> at 
> org.apache.kafka.clients.consumer.KafkaConsumer.<init>(KafkaConsumer.java:524)
> at 
> org.apache.gobblin.kafka.client.Kafka09ConsumerClient.<init>(Kafka09ConsumerClient.java:116)
> at 
> org.apache.gobblin.kafka.client.Kafka09ConsumerClient.<init>(Kafka09ConsumerClient.java:69)
> at 
> org.apache.gobblin.kafka.client.Kafka09ConsumerClient$Factory.create(Kafka09ConsumerClient.java:224)
> at 
> org.apache.gobblin.source.extractor.extract.kafka.KafkaSource.getWorkunits(KafkaSource.java:210)
> at 
> org.apache.gobblin.runtime.SourceDecorator.getWorkunitStream(SourceDecorator.java:81)
> at 
> org.apache.gobblin.runtime.AbstractJobLauncher.launchJob(AbstractJobLauncher.java:411)
> at 
> org.apache.gobblin.cluster.GobblinHelixJobLauncher.launchJob(GobblinHelixJobLauncher.java:378)
> at org.apache.gobblin.scheduler.JobScheduler.runJob(JobScheduler.java:487)
> at 
> org.apache.gobblin.cluster.HelixRetriggeringJobCallable.runJobLauncherLoop(HelixRetriggeringJobCallable.java:203)
> at 
> org.apache.gobblin.cluster.HelixRetriggeringJobCallable.call(HelixRetriggeringJobCallable.java:159)
> at 
> org.apache.gobblin.cluster.GobblinHelixJobScheduler.runJob(GobblinHelixJobScheduler.java:228)
> at 
> org.apache.gobblin.cluster.GobblinHelixJob.executeImpl(GobblinHelixJob.java:61)
> at org.apache.gobblin.scheduler.BaseGobblinJob.execute(BaseGobblinJob.java:58)
> at org.quartz.core.JobRunShell.run(JobRunShell.java:202)
> at 
> org.quartz.simpl.SimpleThreadPool$WorkerThread.run(SimpleThreadPool.java:573)
> Caused by: org.apache.kafka.common.KafkaException: 
> java.lang.IllegalArgumentException: You must pass 
> java.security.auth.login.config in secure mode.
> at 
> org.apache.kafka.common.network.SaslChannelBuilder.configure(SaslChannelBuilder.java:74)
> at 
> org.apache.kafka.common.network.ChannelBuilders.create(ChannelBuilders.java:60){code}
> I have these conf options in my config for kerberos auth:
> gobblin.yarn.keytab.file.path="/home/morpheus2/.keytab"
> gobblin.yarn.keytab.principal.name=morpheus2
>  



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

Reply via email to