Skip to content

Commit

Permalink
Update kafka.sh (#1203)
Browse files Browse the repository at this point in the history
* Update kafka.sh

With primary workers naming convention getting changed, we cannot rely on the worker number anymore, hence changing the broker id for primary workers.

* Update kafka.sh
  • Loading branch information
akhanna213 authored Jul 25, 2024
1 parent e8a4388 commit b36c441
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions kafka/kafka.sh
Original file line number Diff line number Diff line change
Expand Up @@ -149,8 +149,9 @@ function install_and_configure_kafka_server() {
BROKER_ID=$((10000 + $(hostname | sed 's/.*-m-\([0-9]*\)$/\1/g')))
fi
else
# For worker nodes, broker ID is the worker ID.
BROKER_ID=$(hostname | sed 's/.*-w-\([0-9]*\)$/\1/g')
# For worker nodes, broker ID is a random number generated less than 10000.
# 10000 is choosen since the max broker ID allowed being set is 10000.
BROKER_ID=$((RANDOM % 10000))
fi
sed -i 's|log.dirs=/tmp/kafka-logs|log.dirs=/var/lib/kafka-logs|' \
"${KAFKA_PROP_FILE}"
Expand Down

0 comments on commit b36c441

Please sign in to comment.