First, install the JDK
The process will not introduce too much ...
Second, install Zookeeper
Installation process, reference may here ~
Third, install and configure kafka
- Kafka Download http://kafka.apache.org/downloads
- Unzip the file (my directory is E: \ zhanghaoBF \ kafka \ kafka_2.11-2.3.0 [PS: here do not have spaces between the directory Program Files such as file name, or else one will perform will not recognize the path ] )
- Open the directory E: \ zhanghaoBF \ kafka \ kafka_2.11-2.3.0 \ config file under server.properties, the log.dirs revised to [log.dirs = D: \ kafka_2.12-0.11.0.0 \ kafka-logs] , the listeners configuration release
Fourth, start and test kafka
Start ZK
Start kafka
Kafka file into the directory E: \ zhanghaoBF \ kafka \ kafka_2.11-2.3.0, execute the following command to start the communication server broker kafka
.\bin\windows\kafka-server-start.bat .\config\server.properties
Creating topic
Kafka file into the directory E: \ zhanghaoBF \ kafka \ kafka_2.11-2.3.0, enter the following command to create kafka news topics [topic] called testDemo
kafka-topics.bat --create --zookeeper localhost:2181 --replication-factor 1 --partitions 1 --topic testDemo
Start Producer
Kafka file directory to the directory E: \ zhanghaoBF \ kafka \ kafka_2.11-2.3.0, enter the following command to create Producer
## this command to modify the name of the command-line window, this command may not be executed directly execute the following command to start the producer
title producer
kafka-console-producer.bat --broker-list localhost:9092 --topic testDemo
After startup can enter a message in a window:
Start Consumers
Kafka file directory to the directory E: \ zhanghaoBF \ kafka \ kafka_2.11-2.3.0, enter the following command to create consumer
## this command to modify the name of the command-line window, this command may not be executed directly execute the following command to start the consumer
title consumer
kafka-console-consumer.bat --bootstrap-server localhost:9092 --topic testDemo --from-beginning
After startup can enter a message in a window:
PS: Some Bowen would recommend the use of
kafka-console-consumer.bat --zookeeper localhost:2181 --topic testDemo
The command to start the consumer to explain here, the low version of kafka is the command to start and a message consumer spending, due to the higher kafka version as used herein, is why we have the above command line consumers start and consumer information.