Reference URL:
70154278
Prerequisites: The Windows environment requires a JDK installation
1. Download Kafka, you can download kafka,http://kafka.apache.org/through the official website, currently using version kafka_2.11-1.1.0.tgz (ASC, SHA512)
2. since Kafka relies on zookeeper, it is also necessary to download zookeeper, which can be downloaded via the official website http://zookeeper.apache.org/
3. Installing Zookeeper
- After extracting the compressed package, go to the bin directory and start Zkserver.bat
Note: The default address of the ZOOKEEPER is: localhost:2181; environment variable needs to be configured: New Zookeeper_home, path to ZOOKEEPER installation directory, add%zookeeper_home%\conf to Path
Start Zookeeper success
4. Installing Kafka
- Unzip the Kafka compressed package, where Zookeeper's address in Kafka profile Config\server.properties is also default to localhost:2181
- Select Kafka Unzip the file, shift+ the right mouse button, select "Open command Line window (W) Here", open the command line, enter the following command to start the Kafka:
Bin\windows\kafka-server-start.bat config\server.properties
- After the boot is complete, select Kafka unzip the file, shift+ the right mouse button, select "Open command Line window (W) Here", open the command line, enter the following command, create a topic theme
Bin\windows\kafka-topics.bat--create--zookeeper localhost:2181--replication-factor 1--partitions 1--topic test
- Use the following command to view a list of topics created: Bin\windows\kafka-topics.bat--list--zookeeper localhost:2181
- To start a producer, you can send a message:
Bin\windows\kafka-console-producer.bat--broker-list localhost:9092--topic test
After executing the above command, you can enter text freely in the console
- Then select Kafka Unzip the file, shift+ the right mouse button, select "Open command Line window (W)", open the command line, enter the following command to start the consumer
Bin\windows\kafka-console-consumer.bat--zookeeper localhost:2181--topic test--from-beginning
Can see that consumers can successfully receive messages
Build Kafka under Windows and send and receive messages through the command window