对于窗户
启动zookeeper
C:\kafka-2.12>.\bin\windows\zookeeper-server-start.bat .\config\server.properties
启动 Kafka Broker
C:\kafka-2.12>.\bin\windows\kafka-server-start.bat .\config\server.properties
创建主题
C:\kafka-2.12\bin\windows>kafka-topics.bat --create --zookeeper localhost:2181 --replication-factor 1 --partitions 1 --topic test
开始制作人
C:\kafka-2.12\bin\windows>kafka-console-producer.bat --broker-list localhost:9092 --topic test
创建消费者
C:\kafka-2.12\bin\windows>kafka-console-consumer.bat --bootstrap-server localhost:9092 --topic test --from-beginning
使用复制因子为 1 的多分区创建主题
C:\kafka-2.12\bin\windows>kafka-topics --zookeeper localhost:2181 --topic first_topic --create --partitions 3 --replication-factor 1
获取系统创建的话题列表
C:\kafka-2.12\bin\windows>kafka-topics --zookeeper localhost:2181 --list
获取系统创建主题的描述
C:\kafka-2.12\bin\windows>kafka-topics.bat --describe --zookeeper localhost:2181 --topic test
删除系统中创建的主题测试
C:\kafka-2.12\bin\windows>kafka-run-class.bat kafka.admin.TopicCommand --delete --topic test --zookeeper localhost:2181
从系统中创建的主题测试开始读取消息(版本>2.0)
C:\kafka-2.12\bin\windows>kafka-console-consumer.bat --bootstrap-server localhost:9092 --topic test --from-beginn