Skip to content

Commit

Permalink
Support mechanism to provide external zookeeper-server list to build …
Browse files Browse the repository at this point in the history
…global/configuration zookeeper (apache#15987)
  • Loading branch information
rdhabalia authored Jun 21, 2022
1 parent 09be797 commit e976bec
Showing 1 changed file with 14 additions and 6 deletions.
20 changes: 14 additions & 6 deletions docker/pulsar/scripts/generate-zookeeper-config.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit e976bec

Please sign in to comment.