kafka中的shell基本操作

1.启动

#zookeeper
zookeeper-server-start.bat
#kafka
kafka-server-start.bat D:\kafka_2.12-2.2.0\config\server.properties

2.查询topic列表

sh kafka-topics.bat --bootstrap-server localhost:9092 --list

3.查询指定topic中的数据

sh kafka-console-consumer.bat --bootstrap-server localhost:9092 --topic kkis01 --offset 10 --partition 0 --max-messages 10

kafka-console-consumer.bat --bootstrap-server localhost:9092 --topic AI --from-beginning

kafka-console-consumer.bat --bootstrap-server localhost:9092 --topic AI --from-beginning > test.txt

Guess you like

Origin blog.csdn.net/chushudu/article/details/120331313