kafka安装可参考这一篇博客https://blog.csdn.net/github_38482082/article/details/82112641

我安装的是kafka_2.11-2.3.1,要注意实际写代码中服务器和idea客户端的中maven版本要对应
2.3.x对应于kafka-clients 2.3.1

进入
kafka的安装目录,对我是E:\install\kafka_2.11-2.3.1 ,在目录的搜索里面输入cmd,回车,进入cmd就可使用以下kafka指令
windows下kafka命令总结

 

1)启动kafka内置的zookeeper,不关闭页面
.\bin\windows\zookeeper-server-start.bat  .\config\zookeeper.properties

2)kafka服务启动 ,不关闭页面
.\bin\windows\kafka-server-start.bat .\config\server.properties

3)创建topic测试主题kafka,成功不关闭页面
.\bin\windows\kafka-topics.bat --create --zookeeper localhost:2181 --replication-factor 1 --partitions 1 --topic test

4)创建生产者产生消息,不关闭页面
.\bin\windows\kafka-console-producer.bat --broker-list localhost:9092 --topic test

5)创建消费者接收消息,不关闭页面
.\bin\windows\kafka-console-consumer.bat --bootstrap-server localhost:9092 --topic test --from-beginning

1、查询topic,进入kafka目录:
.\bin\windows\kafka-topics.bat --list --zookeeper localhost:2181
 
2、查询topic配置信息:
.\bin\windows\kafka-topics.bat --describe --zookeeper localhost:2181 --topic topicname
可以显示

Topic:topic1    PartitionCount:1        ReplicationFactor:1     Configs:
        Topic: topic1   Partition: 0    Leader: 0       Replicas: 0     Isr: 0

3、查询topic内容:

 

4、删除topic:
.\bin\windows\kafka-topics.bat kafka.admin.DeleteTopicCommand --zookeeper localhost:2181 --delete --topic linlin
显示marked for deletion

相关文章: