First make sure the machine is installed Zookeeper,zookeeper installation reference Windows standalone configuration zookeeper environment
Then make sure the zookeeper is in the normal boot state
Download Kafka
Http://kafka.apache.org/downloads.html
Download binary Package
Unzip after download, I extracted here to the D:\WorkSoftware\kafka_2.11_0.10.1.0 directory
Unzip
First create an empty folder logs
Create a Logs folder
Go to config directory, edit server.properties file
Edit Server.properties
Modify the address of the log.dirs attribute section
Modifying the Log.dirs Property
Then in the D:\WorkSoftware\kafka_2.11_0.10.1.0 directory, press and hold shift+ right mouse button
Open a command Window here
Then enter the following command
.\bin\windows\kafka-server-start.bat .\config\server.properties
Enter, execute command
Error occurred
If an error occurs, I analyze here that Classpath is not configured correctly, then set Classpath first, then execute
CLASSPATH=.;
Set Classpath success
To test, first enter the D:\WorkSoftware\kafka_2.11-0.10.1.0\bin\windows directory and then open the Command window in the current directory
Enter the following command to create a topic
kafka-topics.bat --create --zookeeper localhost:2181 --replication-factor 1 --partitions 1 --topic test.topic
If you also encounter errors such as the inability to load classes, set the Classpath first
Encountered unable to load main class, need to set Classpath topic creation succeeded
Open a producer
kafka-console-producer.bat --broker-list localhost:9092 --topic test.topic
Execute command, open producer
These three windows do not close the case (Zookeeper/kafka/producer), open a command window again (or in the Kafka directory right-click), enter the following command, open consumer
kafka-console-consumer.bat --zookeeper localhost:2181 --topic test.topic
This way, there are 4 command windows
respectively is
- Zookeeper
- Kafka
- Producer
- Consumer
Below, we enter some characters in Window # 3rd (Producer), and we'll see window 4th and we'll get a message.
So far, Kafka's Windows stand-alone environment has been built
Sphsyv
Links: https://www.jianshu.com/p/64d25dcf8300
Source: Pinterest
The copyright of the book is owned by the author, and any form of reprint should be contacted by the author for authorization and attribution.
Windows Standalone Configuration Kafka environment