You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pulsar.apache.org by rd...@apache.org on 2022/06/21 22:59:14 UTC

[pulsar] branch master updated: Support mechanism to provide external zookeeper-server list to build global/configuration zookeeper (#15987)

This is an automated email from the ASF dual-hosted git repository.

rdhabalia pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/pulsar.git


The following commit(s) were added to refs/heads/master by this push:
     new e976bec05fb Support mechanism to provide external zookeeper-server list to build global/configuration zookeeper (#15987)
e976bec05fb is described below

commit e976bec05fb6be9d51115bce52972f733bb0c10a
Author: Rajan Dhabalia <rd...@apache.org>
AuthorDate: Tue Jun 21 15:59:05 2022 -0700

    Support mechanism to provide external zookeeper-server list to build global/configuration zookeeper (#15987)
---
 docker/pulsar/scripts/generate-zookeeper-config.sh | 20 ++++++++++++++------
 1 file changed, 14 insertions(+), 6 deletions(-)

diff --git a/docker/pulsar/scripts/generate-zookeeper-config.sh b/docker/pulsar/scripts/generate-zookeeper-config.sh
index 53d7600f80e..2852742ef26 100755
--- a/docker/pulsar/scripts/generate-zookeeper-config.sh
+++ b/docker/pulsar/scripts/generate-zookeeper-config.sh
@@ -34,14 +34,22 @@ DOMAIN=`hostname -d`
 IDX=1
 for SERVER in $(echo $ZOOKEEPER_SERVERS | tr "," "\n")
 do
-    echo "server.$IDX=$SERVER.$DOMAIN:2888:3888" >> $CONF_FILE
-
-    if [ "$HOSTNAME" == "$SERVER" ]; then
-        MY_ID=$IDX
-        echo "Current server id $MY_ID"
+    if [[ ! -z "$EXTERNAL_PROVIDED_SERVERS" && $(fgrep -ix $EXTERNAL_PROVIDED_SERVERS <<< "true") ]]; then
+       echo "server.$IDX=$SERVER" >> $CONF_FILE
+       # external zk-server connect string starts with hostname
+       if [[ "$SERVER" == "$HOSTNAME"* ]]; then
+         MY_ID=$IDX
+         echo "Current server id $MY_ID"
+       fi
+    else
+       echo "server.$IDX=$SERVER.$DOMAIN:2888:3888" >> $CONF_FILE
+       if [ "$HOSTNAME" == "$SERVER" ]; then
+         MY_ID=$IDX
+         echo "Current server id $MY_ID"
+       fi
     fi
 
-	((IDX++))
+    ((IDX++))
 done
 
 # For ZooKeeper container we need to initialize the ZK id