kafka消费之kafka查看topic是否有数据

时间:2019-11-25 19:46:04   收藏:0   阅读:2779

通过原生kafka,查看对应的topic是否有数据

./kafka-server-start.sh ../config/server.properties 1>/dev/null 2>&1 &     # kafka-server-start.sh 脚本在 kafka_2.12-2.2.0/bin路径下
  • 查看已创建的topic列表:
 ./kafka-topics.sh --list --zookeeper localhost:2181
  • 查看对应topic的描述信息: 
./kafka-topics.sh --describe --zookeeper xx.x.xxx.xxx:2181 --topic xxxxx.xx.xxxxx.xxx     # --zookeeper为zookeeperIP, --topic为topic名称 
  • 消费消息:
./kafka-console-consumer.sh --bootstrap-server localhost:9092 --topic xxxxx.xx.xxxxx.xxx --from-beginning    # 若没有任何返回或没有响应,则该topic中没有数据内容;否则有

 

 
参考链接:https://blog.csdn.net/panchang199266/article/details/82113453
 
 

原文:https://www.cnblogs.com/sunshine-blog/p/11929867.html

评论(0
© 2014 bubuko.com 版权所有 - 联系我们:wmxa8@hotmail.com
打开技术之扣,分享程序人生!