This repository has been archived on 2025-09-14. You can view files and clone it, but cannot push or open issues or pull requests.
Files
galaxy-deployment-k8s/zk-kafka/host.sh
2020-05-25 16:48:37 +08:00

14 lines
334 B
Bash
Executable File

#!/bin/bash
HOSTNAME=`hostname -s`
if [[ $HOSTNAME =~ (.*)-([0-9]+)$ ]]; then
ORD=${BASH_REMATCH[2]}
PORT=$((ORD + 9092))
#12.345.67.8 是 LB 的 ip
export KAFKA_CFG_ADVERTISED_LISTENERS="PLAINTEXT://192.168.40.127:$PORT"
else
echo "Failed to get index from hostname $HOST"
exit 1
fi
echo $KAFKA_CFG_ADVERTISED_LISTENERS