config/server.properties
爲server1.properties
和server2.properties
server1.properties
爲例,修改配置broker.id=1 listeners=PLAINTEXT://:9093 log.dirs=E:\\Develop\\kafka\\2.11-2.1.1\\kafka_2.11-2.1.1\\kafka-logs1 zookeeper.connect=localhost:12181,localhost:12182,localhost:12183
配置ZooKeeper集羣可參考html
分別啓動配置的server1和server2apache
.\bin\windows\kafka-server-start.bat .\config\server1.properties .\bin\windows\kafka-server-start.bat .\config\server2.properties
在一個Kafka上啓動一個生產者:bootstrap
PS E:\Develop\kafka\2.11-2.1.1\kafka_2.11-2.1.1> .\bin\windows\kafka-console-producer.bat --broker-list localhost:9093 --topic test
在另外一個Kafka上啓動一個消費者:windows
PS E:\Develop\kafka\2.11-2.1.1\kafka_2.11-2.1.1> .\bin\windows\kafka-console-consumer.bat --bootstrap-server localhost:9094 --topic test
若是,生產者上發送的消息,在消費者上能夠接收到,證實集羣成功。code
Kafka官網server