Reputation: 41
I have docker container running kafka. Once I push the message I want to run a console based consumer and listen from the particular topic. is there any way to do that?
Upvotes: 1
Views: 834
Reputation: 2072
Kafka Cheatsheet FYR,
Console Producer & Consumer
kafka-console-consumer --zookeeper localhost:2181/kafka --topic topic_name --from-beginning
kafka-console-producer --broker-list localhost:9092 --topic topic_name
kafka-topics --zookeeper localhost:2181/kafka --list
Topic details & Deleting topic
kafka-topics --describe --zookeeper localhost:2181/kafka --topic topic_name
kafka-configs --zookeeper localhost:2181/kafka --alter --entity-type topics --entity-name topic_name --add-config retention.ms=1000
kafka-topics --delete --zookeeper localhost:2181/kafka --topic topic_name
Check active brokers
zookeeper-shell localhost:2181/kafka ls /brokers/ids
KafkaCat
kafkacat -b localhost:9092 -L | grep topic
kafkacat -C -b localhost:9092 -o -5 -t topic_name
Upvotes: 1