Skip to content
This repository was archived by the owner on Oct 1, 2020. It is now read-only.
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 11 additions & 1 deletion kafka/scripts/start-kafka.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
# Optional ENV variables:
# * ADVERTISED_HOST: the external ip for the container, e.g. `docker-machine ip \`docker-machine active\``
# * ADVERTISED_PORT: the external port for Kafka, e.g. 9092
# * ZK_SERVER: the zookeeper server and port kafka connects to, e.g "localhost:2181"
# * ZK_CHROOT: the zookeeper chroot that's used by Kafka (without / prefix), e.g. "kafka"
# * LOG_RETENTION_HOURS: the minimum age of a log file in hours to be eligible for deletion (default is 168, for 1 week)
# * LOG_RETENTION_BYTES: configure the size at which segments are pruned from the log, (default is 1073741824, for 1GB)
Expand All @@ -24,6 +25,15 @@ if [ ! -z "$ADVERTISED_PORT" ]; then
sed -r -i "s/#(advertised.port)=(.*)/\1=$ADVERTISED_PORT/g" $KAFKA_HOME/config/server.properties
fi

# Config zookeeper connect
if [ ! -z "$ZK_SERVER" ]; then
echo "zookeeper server: $ZK_SERVER"
sed -r -i "s/(zookeeper.connect)=(.*)/\1=$ZK_SERVER/g" $KAFKA_HOME/config/server.properties
else
$ZK_SERVER=localhost:2181
fi


# Set the zookeeper chroot
if [ ! -z "$ZK_CHROOT" ]; then
# wait for zookeeper to start up
Expand All @@ -38,7 +48,7 @@ if [ ! -z "$ZK_CHROOT" ]; then
}

# configure kafka
sed -r -i "s/(zookeeper.connect)=(.*)/\1=localhost:2181\/$ZK_CHROOT/g" $KAFKA_HOME/config/server.properties
sed -r -i "s/(zookeeper.connect)=(.*)/\1=$ZK_SERVER\/$ZK_CHROOT/g" $KAFKA_HOME/config/server.properties
fi

# Allow specification of log retention policies
Expand Down