Bootstrapping a Kafka env
  05-09-2020 · 1 minute read · 87 words


Startup ZK

./bin/zookeeper-server-start.sh config/zookeeper.properties

Standup Kafka

./bin/kafka-server-start.sh config/server.properties &

Creating first topic

kafka-topics.sh --zookeeper localhost:2181 --create --topic first --partitions 2 --replication-factor 2

Describe topic

kafka-topics --zookeeper localhost:2181 --describe --topic first

Pub sub Consumer example

Consume the topic first from the Kafka cluster directly. (Subscribe)

kafka-console-consumer --bootstrap-server localhost:9092 --topic first --from-beginning

I believe this is the legacy way of doing this which was to subscribe to the zookeeper broker. However this doesn’t work anymore.

kafka-console-consumer --zookeeper localhost:2181 --topic first

Pub sub Producer example

kafka-console-producer --broker-list localhost:9092 --topic first

comments powered by Disqus