Skip to content

Instantly share code, notes, and snippets.

@NISH1001
Last active March 3, 2019 12:36
Show Gist options
  • Save NISH1001/7f036db7871db17b8c0d5b0336c73f8b to your computer and use it in GitHub Desktop.
Save NISH1001/7f036db7871db17b8c0d5b0336c73f8b to your computer and use it in GitHub Desktop.

Start Zookeeper Server

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

Start Kafka Server

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

Create a topic

bin/kafka-topics.sh --create --zookeeper localhost:2181 --replication-factor 1 --partitions 1 --topic test

List available topics

bin/kafka-topics.sh --list --zookeeper localhost:2181

Produce message using the topic "test"

bin/kafka-console-producer.sh --broker-list localhost:9092 --topic test

Display messages

#bin/kafka-console-consumer.sh --zookeeper localhost:2181 --topic test --from-beginning
bin/kafka-console-consumer.sh --bootstrap-server localhost:9092 --topic test --from-beginning

Delete Topic

bin/kafka-topics.sh --zookeeper 127.0.0.1:2181 --delete --topic <topicName>

Note: delete.topic.enable should be set to true

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment