14 lines
494 B
Bash
14 lines
494 B
Bash
#!/bin/bash
|
|
HOST=`hostname -s`
|
|
if [[ $HOST =~ (.*)-([0-9]+)$ ]]; then
|
|
NAME=${BASH_REMATCH[1]}
|
|
ORD=${BASH_REMATCH[2]}
|
|
else
|
|
echo "Failed to extract ordinal from hostname $HOST"
|
|
exit 1
|
|
fi
|
|
|
|
MY_ID=$((ORD+1))
|
|
sed -i s"/broker.id=0/broker.id=$MY_ID/g" /opt/kafka/config/server.properties
|
|
sed -i s'/zookeeper.connect=localhost:2181/zookeeper.connect=zk-0.zk-svc.brand.svc:2181,zk-1.zk-svc.brand.svc:2181,zk-2.zk-svc.brand.svc:2181/g' /opt/kafka/config/server.properties
|