zookeeper&kafka基本操作和可视化工具使用

zookeeper:

https://www.w3cschool.cn/zookeeper/zookeeper_cli.html

kafka:

https://cloud.tencent.com/developer/article/1775065

kafka可视化工具使用帮助:

Kafka 可视化工具(Kafka Tool) - 龙凌云端 - 博客园 (cnblogs.com)

命令行启动kafka:

./bin/zookeeper-server-start.sh config/zookeeper.properties
./bin/kafka-server-start.sh config/server.properties

后台启动kafka:

nohup ./bin/zookeeper-server-start.sh config/zookeeper.properties &

./bin/kafka-server-start.sh -daemon config/server.properties

1、查看topic

bin/kafka-topics.sh --bootstrap-server localhost:9092 --list

 
2、查看一个具体topic的详情
bin/kafka-topics.sh --describe --topic first --bootstrap-server localhost:9092
 
3、查询topic内容
bin/kafka-console-consumer.sh --bootstrap-server localhost:9092 --topic first --from-beginning
 
4、创建topic
bin/kafka-topics.sh --bootstrap-server localhost:9092 --create --topic first
 
5、往topic 为 first 的内部生产消息
bin/kafka-console-producer.sh --broker-list localhost:9092 --topic first
 
6、从topic 为first的内部消费消息
bin/kafka-console-consumer.sh --bootstrap-server localhost:9092 --topic first
7、每个分区消息数量。-1获取最大位移 -2获取最小位移 。相减获取消息数量
bin/kafka-run-class.sh kafka.tools.GetOffsetShell --broker-list localhost:9092 --topic first --time -1
bin/kafka-run-class.sh kafka.tools.GetOffsetShell --broker-list localhost:9092 --topic first --time -2
https://www.cnblogs.com/zhangkaimin/p/16547054.html
posted @ 2022-10-10 09:50  zjb480  阅读(69)  评论(0)    收藏  举报