Last active
March 31, 2022 07:11
-
-
Save itadventurer/381597803f62d7c46e0165d035f78664 to your computer and use it in GitHub Desktop.
Starting and Stopping single-node 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 | |
set -e | |
KAFKA_PATH=~/kafka | |
echo "Starting Zookeeper…" | |
${KAFKA_PATH}/bin/zookeeper-server-start.sh -daemon ${KAFKA_PATH}/config/zookeeper.properties | |
${KAFKA_PATH}/bin/kafka-server-start.sh -daemon ${KAFKA_PATH}/config/server.properties | |
echo "Zookeeper started. Waiting 5s to finish booting" | |
sleep 5 | |
echo -n "Testing Connection…" | |
${KAFKA_PATH}/bin/zookeeper-shell.sh localhost:2181 ls / > /dev/null | |
echo -e "\tOK" | |
echo "Kafka started. Waiting 15s to finish booting" | |
sleep 15 | |
echo -n "Testing Connection…" | |
kafka-broker-api-versions.sh --bootstrap-server localhost:9092 > /dev/null | |
echo -e "\tOK" | |
echo "Happy Streaming!" |
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 | |
KAFKA_PATH=~/kafka | |
${KAFKA_PATH}/bin/kafka-server-stop.sh | |
${KAFKA_PATH}/bin/zookeeper-server-stop.sh |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment