How Do You Set Up Apache Kafka on Any Distribution of Linux?

Problem scenario
You want to set up Apache Kafka with a single broker just to test out. How do you do this on any distribution of Linux?

You must install Zookeeper. If you need assistance, see this posting.

You may want to install screen because this solution will rely on it; you could open duplicate terminals instead of using the screen command.

Have Zookeeper running before you run the [Kafka installation] script below.


curl -Ls$kafkaversion.tgz > /tmp/kafka_$kafkaversion.tgz
cd /bin/
cp /tmp/kafka_$kafkaversion.tgz .
sudo tar -zxf kafka_$kafkaversion.tgz
cd kafka_$kafkaversion/bin
./ -daemon /root/kafka/config/
./ --create --bootstrap-server localhost:9092 --replication-factor 1 --partitions 1 --topic test
./ -list --bootstrap-server localhost:9092
echo "Kafka should be installed now"
echo 'Run this command:
./ --broker-list localhost:9092 --topic test
echo "go to another terminal"
and then enter some text'
echo " "
echo 'Start a new terminal, and run this command:
bin/ --bootstrap-server localhost:9092 --topic test --from-beginning'

Leave a comment

Your email address will not be published. Required fields are marked *