How to view kafka message

前端 未结 8 1308
既然无缘
既然无缘 2021-02-01 12:10

Is there any way I can view the message content sent to kafka for a given topic? Say some thing like view last 5 messages for this topic, if that it possible.

相关标签:
8条回答
  • 2021-02-01 12:44

    You can use console consumer to view messages produced on some topic:

    bin/kafka-console-consumer.sh --bootstrap-server localhost:9092 --topic test --from-beginning
    
    0 讨论(0)
  • 2021-02-01 12:58

    If you're wondering why the original answer is not working. Well it might be that you're not in the home directory. Try this:

    $KAFKA_HOME/bin/kafka-console-consumer.sh --bootstrap-server localhost:9092 --topic test --from-beginning
    
    0 讨论(0)
提交回复
热议问题