Skip to content

Instantly share code, notes, and snippets.

@dgadiraju
Last active November 11, 2022 14:08
  • Star 5 You must be signed in to star a gist
  • Fork 5 You must be signed in to fork a gist
Star You must be signed in to star a gist
Save dgadiraju/c4ed3195e563779e97a1658598269652 to your computer and use it in GitHub Desktop.
# Create topics
kafka-topics.sh --create \
--zookeeper m01.itversity.com:2181,m02.itversity.com:2181,w01.itversity.com:2181 \
--replication-factor 1 \
--partitions 1 \
--topic kafkadg
# List all topics
kafka-topics.sh --list \
--zookeeper m01.itversity.com:2181,m02.itversity.com:2181,w01.itversity.com:2181
# List one topic
kafka-topics.sh --list \
--zookeeper m01.itversity.com:2181,m02.itversity.com:2181,w01.itversity.com:2181 \
--topic kafkadg
kafka-topics.sh --delete \
--zookeeper m01.itversity.com:2181,m02.itversity.com:2181,w01.itversity.com:2181 \
--topic testdg
# Command to produce messages, start typing after running this kakfa-console-producer command
# The messages will be stored in topic kafkadg on the host where brokers are running
kafka-console-producer.sh \
--broker-list w01.itversity.com:9092,w02.itversity.com:9092,w03.itversity.com:9092 \
--topic kafkadg
# Open another shell and then run kafka-console-consumer command to see streaming messages
kafka-console-consumer.sh \
--bootstrap-server w01.itversity.com:9092,w02.itversity.com:9092,w03.itversity.com:9092 \
--topic kafkadg \
--from-beginning
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment