13 lines
622 B
Bash
Executable File
13 lines
622 B
Bash
Executable File
#!/usr/bin/env bash
|
|
set -euo pipefail
|
|
advertised_host=${KAFKA_ADVERTISED_HOST:?Set the VM LAN IP or DNS name}
|
|
[[ $advertised_host =~ ^[a-zA-Z0-9][a-zA-Z0-9.-]*$ ]] || {
|
|
echo 'KAFKA_ADVERTISED_HOST must be an IPv4 address or DNS name, without protocol/port.' >&2
|
|
exit 1
|
|
}
|
|
sed "s/__KAFKA_ADVERTISED_HOST__/$advertised_host/g" \
|
|
/etc/kafka/server.properties > /tmp/host-metrics-server.properties
|
|
/opt/kafka/bin/kafka-storage.sh format --ignore-formatted \
|
|
--cluster-id 'MkU3OEVBNTcwNTJENDM2Qk' --config /tmp/host-metrics-server.properties
|
|
exec /opt/kafka/bin/kafka-server-start.sh /tmp/host-metrics-server.properties
|