Created
January 2, 2019 17:24
-
-
Save sblack4/a9d9e958ea999a862c800da57df43c47 to your computer and use it in GitHub Desktop.
Bash script to install the most minimal Kafka
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# this script installs and starts kafka | |
# the most minimal installation of kafka possible | |
KAFKA_URL=http://mirror.olnevhost.net/pub/apache/kafka/2.1.0/kafka_2.11-2.1.0.tgz | |
install_kafka() { | |
cd /opt | |
wget $KAFKA_URL | |
tar xvzf kafka_* | |
mv kafka_2.11-2.1.0 kafka | |
} | |
start_kafka() { | |
ZOOKEEPER_LOG=/var/log/zookeeper.log | |
# start zookeeeper | |
bin/zookeeper-server-start.sh config/zookeeper.properties > $ZOOKEEPER_LOG 2>&1 & | |
# wait for zookeeper to *actually* start before proceeding | |
sudo tail -f $ZOOKEEPER_LOG | while read LOGLINE | |
do | |
[[ "${LOGLINE}" == *"INFO binding to port 0.0.0.0/0.0.0.0:2181"* ]] && pkill -P $$ tail | |
done | |
# now we can start kafka | |
bin/kafka-server-start.sh config/server.properties > /var/log/kafka.log 2>&1 | |
} | |
main() { | |
install_kafka | |
start_kafka | |
} | |
main "$@" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment