Kafka needs zk to support. So download zk first
1. Download and install zookeeper
Choose without source
Download and unzip 2 times
Go to the D:\zookeeper\apache-zookeeper-3.6.1-bin\conf directory and rename zoo_sample.cfg to zoo.cfg
Modify zoo.cfg
Data files will be generated here
Add ZK environment variables
ZK is now configured. You can start ZK
Or open cmd and enter zkserver
Prompt this startup is successful!
2. Download and install kafka
Download the latest version
After downloading, decompress, you have to decompress twice
Enter: D:\kafka\kafka_2.12-2.5.0\config
Modify server.properties
Go to the D:\kafka\kafka_2.12-2.5.0 directory and execute.\bin\windows\kafka-server-start.bat .\config\server.properties
Kafka started successfully!
Test use
Do not close zk and Kafka that has just been started.
Create topic and
enter the windows directory of
Kafka to execute the following command. 2181 is the zookeeper port kafka-topics.bat --create --zookeeper localhost:2181 --replication-factor 1 --partitions 1- -topic demo
Create topic successfully!
Start two more windows, one consumer and one producer,
and enter into the windows directory of Kafka to execute the following commands. 9092 is the port
producer of Kafka : kafka-console-producer.bat --broker-list localhost:9092 --topic demo
consumer:kafka-console-consumer.bat --bootstrap-server localhost:9092 --topic demo --from-beginning
4 services started:
You can enter the content at will in the producer service window, and the consumer service window will receive it. At this point, the test is complete, and the test result is OK!
Welcome to leave comments and learn together!!! Thanks!!!
===========================
Original article, reprinted with the source!