Experimental platform and Software:
Operating system: Windows7 32-bit
Java Development Package: jdk1.8.0_144
Cluster: zookeeper-3.3.6
Message Queuing: kafka_2.11-0.11.0.1
Installation sequence:
1. JDK Installation Pre-configuration
Jdk-8u144-windows-i586_8.0.1440.1.exe
Click Install: "Next" ...
Environment variable configuration:
1) Computer/Properties/Advanced system settings/Advanced/environment variable, new variable in system variable: Java_home value:C:\Program
files\java\jdk1.8.0_144 (adjusted according to installation path)
2) New variable: Classpath, Value:.; %java_home%\lib;%java_home%\lib\tools.jar
3) Finally in the system variable: Path value after adding: %java_home%\bin;%java_home%\jre\bin;
Test
Open cmd Command Window input: java-version
Enter execution if the Java version is displayed correctly the installation configuration is successful
Note:
1) Multiple environment variable values are separated by semicolons
2) The Classpath value is preceded by a small dot
2. Zookeeper Installation Configuration
1) Compressed Package decompression: zookeeper-3.3.6
2) New Data folder under Directory
3) Conf directory, then copy zoo_sample.cfg to zoo.cfg
4) Modify the Datadir=d:\zookeeper-3.3.6\zookeeper-3.3.6\data in Zoo.cfg
(according to the decompression path to adjust accordingly)
3. Start Zookeeper
go to the bin directory and execute Zkserver.cmd
Open command Window in Bin directory: SHIFT + right mouse button
Input: Zkserver.cmd Enter execution
4 Kafka Configuration
Compressed Package Decompression: D:\kafka_2.11-0.11.0.1
Go to config directory, edit server.properties file
Log.dirs=d:\kafka_2.11-0.11.0.1\logs
Execute the cmd command under path D:\kafka_2.11-0.11.0.1:
.\bin\windows\kafka-server-start.bat .\config\server.properties
在路径bin\window下
1)创建 topic :
kafka-topics.bat --create --zookeeper localhost:2181 --replication-factor 1 --partitions 1 --topic test.topic
2) 创建 producer:
kafka-console-producer.bat --broker-list localhost:9092 --topic test.topic
3) 创建 consummer:
kafka-console-consumer.bat --zookeeper localhost:2181 --topic test.topic
5 测试
下面,我们在窗口(Producer)输入一些字符,就会看到
consummer
窗口马上就收到消息。
Example of getting Started with Windows Kafka configuration