pinot-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From xian...@apache.org
Subject [incubator-pinot] 01/01: fixing start kafka command
Date Mon, 03 Feb 2020 09:27:12 GMT
This is an automated email from the ASF dual-hosted git repository.

xiangfu pushed a commit to branch ISSUE-5041
in repository https://gitbox.apache.org/repos/asf/incubator-pinot.git

commit 093ed70edef3e914f2ae26a28c88335d7e6eacfa
Author: Xiang Fu <fx19880617@gmail.com>
AuthorDate: Mon Feb 3 01:26:53 2020 -0800

    fixing start kafka command
---
 .../apache/pinot/tools/admin/command/StartKafkaCommand.java  | 12 ++++++++----
 .../java/org/apache/pinot/tools/utils/KafkaStarterUtils.java |  2 +-
 2 files changed, 9 insertions(+), 5 deletions(-)

diff --git a/pinot-tools/src/main/java/org/apache/pinot/tools/admin/command/StartKafkaCommand.java
b/pinot-tools/src/main/java/org/apache/pinot/tools/admin/command/StartKafkaCommand.java
index e342c73..548daa6 100644
--- a/pinot-tools/src/main/java/org/apache/pinot/tools/admin/command/StartKafkaCommand.java
+++ b/pinot-tools/src/main/java/org/apache/pinot/tools/admin/command/StartKafkaCommand.java
@@ -20,6 +20,7 @@ package org.apache.pinot.tools.admin.command;
 
 import java.io.File;
 import java.io.IOException;
+import java.util.Properties;
 import org.apache.pinot.spi.stream.StreamDataProvider;
 import org.apache.pinot.spi.stream.StreamDataServerStartable;
 import org.apache.pinot.tools.Command;
@@ -45,7 +46,7 @@ public class StartKafkaCommand extends AbstractBaseAdminCommand implements
Comma
   private int _brokerId = KafkaStarterUtils.DEFAULT_BROKER_ID;
 
   @Option(name = "-zkAddress", required = false, metaVar = "<string>", usage = "Address
of Zookeeper.")
-  private String _zkAddress = "localhost:2181";
+  private String _zkAddress = KafkaStarterUtils.DEFAULT_ZK_STR;
   private StreamDataServerStartable _kafkaStarter;
 
   @Override
@@ -71,15 +72,18 @@ public class StartKafkaCommand extends AbstractBaseAdminCommand implements
Comma
   @Override
   public boolean execute()
       throws IOException {
+    Properties kafkaConfiguration = KafkaStarterUtils.getDefaultKafkaConfiguration();
+    kafkaConfiguration.put(KafkaStarterUtils.BROKER_ID, _brokerId);
+    kafkaConfiguration.put(KafkaStarterUtils.PORT, _port);
+    kafkaConfiguration.put(KafkaStarterUtils.ZOOKEEPER_CONNECT, _zkAddress);
     try {
-      _kafkaStarter = StreamDataProvider.getServerDataStartable(KafkaStarterUtils.KAFKA_SERVER_STARTABLE_CLASS_NAME,
KafkaStarterUtils.getDefaultKafkaConfiguration());
+      _kafkaStarter = StreamDataProvider
+          .getServerDataStartable(KafkaStarterUtils.KAFKA_SERVER_STARTABLE_CLASS_NAME, kafkaConfiguration);
     } catch (Exception e) {
       throw new RuntimeException("Failed to start " + KafkaStarterUtils.KAFKA_SERVER_STARTABLE_CLASS_NAME,
e);
     }
     _kafkaStarter.start();
-
     LOGGER.info("Start kafka at localhost:" + _port + " in thread " + Thread.currentThread().getName());
-
     savePID(System.getProperty("java.io.tmpdir") + File.separator + ".kafka.pid");
     return true;
   }
diff --git a/pinot-tools/src/main/java/org/apache/pinot/tools/utils/KafkaStarterUtils.java
b/pinot-tools/src/main/java/org/apache/pinot/tools/utils/KafkaStarterUtils.java
index 724ab87..0f7eb4e 100644
--- a/pinot-tools/src/main/java/org/apache/pinot/tools/utils/KafkaStarterUtils.java
+++ b/pinot-tools/src/main/java/org/apache/pinot/tools/utils/KafkaStarterUtils.java
@@ -36,7 +36,7 @@ public class KafkaStarterUtils {
 
   public static final String PORT = "port";
   public static final String BROKER_ID = "broker.id";
-  private static final String ZOOKEEPER_CONNECT = "zookeeper.connect";
+  public static final String ZOOKEEPER_CONNECT = "zookeeper.connect";
   private static final String LOG_DIRS = "log.dirs";
 
   public static final String KAFKA_SERVER_STARTABLE_CLASS_NAME =


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@pinot.apache.org
For additional commands, e-mail: commits-help@pinot.apache.org


Mime
View raw message