You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pinot.apache.org by xi...@apache.org on 2021/07/07 05:06:36 UTC
[incubator-pinot] branch master updated: Fixing
Controller/Broker/Server/Minion zk and cluster name configs in
PinotServiceMananger when start using config file (#7131)
This is an automated email from the ASF dual-hosted git repository.
xiangfu pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-pinot.git
The following commit(s) were added to refs/heads/master by this push:
new b99e804 Fixing Controller/Broker/Server/Minion zk and cluster name configs in PinotServiceMananger when start using config file (#7131)
b99e804 is described below
commit b99e804ff1e4458cb73e4766cb0b20fb9b716494
Author: Xiang Fu <xi...@gmail.com>
AuthorDate: Tue Jul 6 22:06:06 2021 -0700
Fixing Controller/Broker/Server/Minion zk and cluster name configs in PinotServiceMananger when start using config file (#7131)
---
.../apache/pinot/tools/admin/command/StartBrokerCommand.java | 11 +++++------
.../pinot/tools/admin/command/StartControllerCommand.java | 4 ++++
.../apache/pinot/tools/admin/command/StartMinionCommand.java | 4 ++++
.../apache/pinot/tools/admin/command/StartServerCommand.java | 4 ++++
4 files changed, 17 insertions(+), 6 deletions(-)
diff --git a/pinot-tools/src/main/java/org/apache/pinot/tools/admin/command/StartBrokerCommand.java b/pinot-tools/src/main/java/org/apache/pinot/tools/admin/command/StartBrokerCommand.java
index 89af4f7..03d5ccb 100644
--- a/pinot-tools/src/main/java/org/apache/pinot/tools/admin/command/StartBrokerCommand.java
+++ b/pinot-tools/src/main/java/org/apache/pinot/tools/admin/command/StartBrokerCommand.java
@@ -23,8 +23,8 @@ import java.net.SocketException;
import java.net.UnknownHostException;
import java.util.HashMap;
import java.util.Map;
+import org.apache.commons.collections.MapUtils;
import org.apache.commons.configuration.ConfigurationException;
-import org.apache.pinot.broker.broker.helix.HelixBrokerStarter;
import org.apache.pinot.spi.services.ServiceRole;
import org.apache.pinot.spi.utils.CommonConstants;
import org.apache.pinot.tools.Command;
@@ -58,8 +58,6 @@ public class StartBrokerCommand extends AbstractBaseAdminCommand implements Comm
@Option(name = "-configFileName", required = false, aliases = {"-config", "-configFile", "-brokerConfig", "-brokerConf"}, metaVar = "<Config File Name>", usage = "Broker Starter Config file.", forbids = {"-brokerHost", "-brokerPort"})
private String _configFileName;
- private HelixBrokerStarter _brokerStarter;
-
private Map<String, Object> _configOverrides = new HashMap<>();
public boolean getHelp() {
@@ -82,9 +80,7 @@ public class StartBrokerCommand extends AbstractBaseAdminCommand implements Comm
@Override
public void cleanup() {
- if (_brokerStarter != null) {
- _brokerStarter.stop();
- }
+
}
@Override
@@ -141,6 +137,9 @@ public class StartBrokerCommand extends AbstractBaseAdminCommand implements Comm
Map<String, Object> properties = new HashMap<>();
if (_configFileName != null) {
properties.putAll(PinotConfigUtils.readConfigFromFile(_configFileName));
+ // Override the zkAddress and clusterName to ensure ServiceManager is connecting to the right Zookeeper and Cluster.
+ _zkAddress = MapUtils.getString(properties, CommonConstants.Helix.CONFIG_OF_ZOOKEEPR_SERVER, _zkAddress);
+ _clusterName = MapUtils.getString(properties, CommonConstants.Helix.CONFIG_OF_CLUSTER_NAME, _clusterName);
} else {
properties.putAll(PinotConfigUtils.generateBrokerConf(_clusterName, _zkAddress, _brokerHost, _brokerPort));
}
diff --git a/pinot-tools/src/main/java/org/apache/pinot/tools/admin/command/StartControllerCommand.java b/pinot-tools/src/main/java/org/apache/pinot/tools/admin/command/StartControllerCommand.java
index 6d2cc37..35ac8d0 100644
--- a/pinot-tools/src/main/java/org/apache/pinot/tools/admin/command/StartControllerCommand.java
+++ b/pinot-tools/src/main/java/org/apache/pinot/tools/admin/command/StartControllerCommand.java
@@ -161,6 +161,10 @@ public class StartControllerCommand extends AbstractBaseAdminCommand implements
Map<String, Object> properties = new HashMap<>();
if (_configFileName != null) {
properties.putAll(PinotConfigUtils.generateControllerConf(_configFileName));
+ // Override the zkAddress and clusterName to ensure ServiceManager is connecting to the right Zookeeper and Cluster.
+ // Configs existence is already verified.
+ _zkAddress = properties.get(ControllerConf.ZK_STR).toString();
+ _clusterName = properties.get(ControllerConf.HELIX_CLUSTER_NAME).toString();
} else {
if (_controllerHost == null) {
_controllerHost = NetUtils.getHostAddress();
diff --git a/pinot-tools/src/main/java/org/apache/pinot/tools/admin/command/StartMinionCommand.java b/pinot-tools/src/main/java/org/apache/pinot/tools/admin/command/StartMinionCommand.java
index 2be3267..6a26028 100644
--- a/pinot-tools/src/main/java/org/apache/pinot/tools/admin/command/StartMinionCommand.java
+++ b/pinot-tools/src/main/java/org/apache/pinot/tools/admin/command/StartMinionCommand.java
@@ -23,6 +23,7 @@ import java.net.SocketException;
import java.net.UnknownHostException;
import java.util.HashMap;
import java.util.Map;
+import org.apache.commons.collections.MapUtils;
import org.apache.commons.configuration.ConfigurationException;
import org.apache.pinot.spi.services.ServiceRole;
import org.apache.pinot.spi.utils.CommonConstants;
@@ -110,6 +111,9 @@ public class StartMinionCommand extends AbstractBaseAdminCommand implements Comm
Map<String, Object> properties = new HashMap<>();
if (_configFileName != null) {
properties.putAll(PinotConfigUtils.readConfigFromFile(_configFileName));
+ // Override the zkAddress and clusterName to ensure ServiceManager is connecting to the right Zookeeper and Cluster.
+ _zkAddress = MapUtils.getString(properties, CommonConstants.Helix.CONFIG_OF_ZOOKEEPR_SERVER, _zkAddress);
+ _clusterName = MapUtils.getString(properties, CommonConstants.Helix.CONFIG_OF_CLUSTER_NAME, _clusterName);
} else {
properties.putAll(PinotConfigUtils.generateMinionConf(_clusterName, _zkAddress, _minionHost, _minionPort));
}
diff --git a/pinot-tools/src/main/java/org/apache/pinot/tools/admin/command/StartServerCommand.java b/pinot-tools/src/main/java/org/apache/pinot/tools/admin/command/StartServerCommand.java
index aa618b2..804f011 100644
--- a/pinot-tools/src/main/java/org/apache/pinot/tools/admin/command/StartServerCommand.java
+++ b/pinot-tools/src/main/java/org/apache/pinot/tools/admin/command/StartServerCommand.java
@@ -23,6 +23,7 @@ import java.net.SocketException;
import java.net.UnknownHostException;
import java.util.HashMap;
import java.util.Map;
+import org.apache.commons.collections.MapUtils;
import org.apache.commons.configuration.ConfigurationException;
import org.apache.pinot.spi.services.ServiceRole;
import org.apache.pinot.spi.utils.CommonConstants;
@@ -167,6 +168,9 @@ public class StartServerCommand extends AbstractBaseAdminCommand implements Comm
Map<String, Object> properties = new HashMap<>();
if (_configFileName != null) {
properties.putAll(PinotConfigUtils.readConfigFromFile(_configFileName));
+ // Override the zkAddress and clusterName to ensure ServiceManager is connecting to the right Zookeeper and Cluster.
+ _zkAddress = MapUtils.getString(properties, CommonConstants.Helix.CONFIG_OF_ZOOKEEPR_SERVER, _zkAddress);
+ _clusterName = MapUtils.getString(properties, CommonConstants.Helix.CONFIG_OF_CLUSTER_NAME, _clusterName);
} else {
properties.putAll(PinotConfigUtils.generateServerConf(_clusterName, _zkAddress, _serverHost, _serverPort,
_serverAdminPort, _dataDir, _segmentDir));
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@pinot.apache.org
For additional commands, e-mail: commits-help@pinot.apache.org