For a complete solution, please refer to:
Setting up and Running Apache Kafka on Windows OS
In the environmental construction process encountered two problems, listed here first, to facilitate the query:1. \java\jre7\lib\ext\qtjava.zip is unexpected at the this time. Process exited
Solution:1.1 Right click on "My Computer", "Advanced system Settings", "Environment variables" 1.2 see if the value of the classpath contains qtjava.zip path, if any, the corresponding path is deleted, the problem is resolved.2. Missing ' server ' JVM (java\jre7\bin\server\jvm.dll.)
Solution:2.1. Copy C:\Program files\java\jdk1.6.0\jre\bin\server2.2 paste to C:\Program files\java\jre1.6.0\bin build environment 1. Installing the JDK
1.1 Installation file: http://www.oracle.com/technetwork/java/javase/downloads/jre8-downloads-2133155.html download server JRE.
1.2 After installation, you need to add the following environment variables (right-click "My Computer", "Advanced system Settings", "Environment variables"):
-
- Java_home:c:\program Files (x86) \java\jre1.8.0_60 (this is the default installation path, if you change the installation directory during installation, fill in the changed path)
-
- PATH: Add after existing value "; %java_home%\bin "
1.3 Open cmd Run "java-version" to view the current system Java version:
2. Installing zookeeper
The Kafka run depends on zookeeper, so we need to install and run the Kafka before running the zookeeper
2.1 Download installation file: http://zookeeper.apache.org/releases.html2.2 Unzip the file (this article extract to G:\zookeeper-3.4.8) 2.3 open G:\zookeeper-3.4.8\ conf, rename the zoo_sample.cfg to zoo.cfg2.4 from the text editor to open zoo.cfg2.5 to change the value of DataDir to ": \zookeeper-3.4.8\data" 2.6 Add the following system variables:
-
- zookeeper_home:g:\zookeeper-3.4.8
- Path: Add ";%zookeeper_home%\bin" after the existing value;
2.7 Run Zookeeper: Open cmd and execute
Zkserver
3. Install and run the Kafka3.1 download installation file: http://kafka.apache.org/downloads.html3.2 Unzip the file (this article extracted to G:\kafka_2.11-0.10.0.1) 3.3 open G:\kafka_ 2.11-0.10.0.1\config3.4 open from a text editor server.properties3.5 change log.dirs value to "G:\kafka_2.11-0.10.0.1\kafka-logs" 3.6 Open cmd3.7 into Kafka file directory: cd/d G:\kafka_2.11-0.10.0.1\3.8 input and execute to open Kafka:
. \bin\windows\kafka-server-start. bat. \config\server.properties
4. Create topics4.1 open cmd and enter G:\kafka_2.11-0.10.0.1\bin\windows4.2 to create a topic:
Kafka-topics.bat--create--zookeeper localhost:2181--replication-factor 1--partitions 1--topic test
5. Open a producer:
CD /d G:\kafka_2.11-0.10.0.1\bin\windowskafka-console-producer. bat--broker-list localhost:9092- -topic Test
6. Open a consumer:
CD /d G:\kafka_2.11-0.10.0.1\bin\windows
Kafka-console-consumer.bat--zookeeper localhost:2181--topic test
You can then enter the message in the Producer Console window. After the message is entered, the consumer window will soon display the message sent by producer: At this point, the Kafka run environment is completed:-)
Build Kafka running Environment on Windows