主题创建、推送、订阅

进入D:\kafka\bin\windows要使用kafka-topics.bat脚本

创建

kafka-topics.bat --bootstrap-server localhost:9092 --topic test --create

查看

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

详细查看

kafka-topics.bat --bootstrap-server localhost:9092 --topic test --descrip 

修改


删除

kafka-topics.bat --bootstrap-server localhost:9092 --topic test --delete

windows下删除,会出现kafka服务会关闭

订阅

打开两个窗口使用kafka-console-consumer.bat和kafka-console-producer.bat

生产者
kafka-console-consumer.bat --bootstrap-server localhost:9092 --topic test

在控制台输入数据后回车

消费者
kafka-console-producer.bat --bootstrap-server localhost:9092 --topic test