Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save balusai1/f7410a2835e0ddfd2721da20e90f1c42 to your computer and use it in GitHub Desktop.
Save balusai1/f7410a2835e0ddfd2721da20e90f1c42 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