Turn from: "Build Kafka Environment on Windows"
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 Classpath contains qtjava.zip path, if any, the corresponding path is deleted, the problem is solved. 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 the Environment1. 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 files: http://zookeeper.apache.org/releases.html2.2 Unzip the file (this article extracts to G:\zookeeper-3.4.8)2.3 Open the G:\zookeeper-3.4.8\conf and rename the zoo_sample.cfg to Zoo.cfg2.4 Opening zoo.cfg from a text editor2.5 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 Kafka3.1 Download installation files: http://kafka.apache.org/downloads.html3.2 Unzip the file (this article extracts to G:\kafka_2.11-0.10.0.1)3.3 Opening G:\kafka_2.11-0.10.0.1\config3.4 Opening server.properties from a text editor3.5 Change the value of Log.dirs to "G:\kafka_2.11-0.10.0.1\kafka-logs"3.6 Open cmd3.7 Entering the Kafka file directory: cd/d G:\kafka_2.11-0.10.0.1\3.8 Enter 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 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 construction of the Kafka operating environment is completed:-)
(go) Build Kafka running environment on Windows