kafka常用命令

发布时间 2023-12-28 10:41:47作者: xiaolifc

Windows

 1.启动zookeeper,kafka高版本已经集成 zookeeper
bin\windows\zookeeper-server-start.bat config\zookeeper.properties
​
 2.启动kafka服务器
bin\windows\kafka-server-start.bat config\server.properties
​
 3.创建topic
bin\windows\kafka-topics.bat --create --bootstrap-server localhost:9092 --replication-factor 1 --partitions 1 --topic singleTopic
​
 4.查看topics
bin\windows\kafka-topics.bat --bootstrap-server localhost:9092 --list
​
 5.查看topic 详细信息
bin\windows\kafka-topics.bat --bootstrap-server localhost:9092 --describe --topic singleTopic
​
 6.删除topic
bin\windows\kafka-topics.bat --delete --bootstrap-server localhost:9092 --topic singleTopic
​
 7.关闭 kafka 服务器
bin\windows\kafka-server-stop.bat