查看kafka的topic数据

  • 启动kafka:
  • ./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中没有数据内容;否则就是有数据

猜你喜欢

转载自blog.csdn.net/AntdonYu/article/details/107351470