First, install the JDK
Second, installation Zooeleeper
Download the installation package: Http://zookeeper.apache.org/releases.html#download
Unzip to a directory after downloading:
1. Enter the Zookeeper settings directory, the author D:\Java\Tool\zookeeper-3.4.6\conf
2. Rename "Zoo_sample.cfg" to "zoo.cfg"
3. Open the zoo.cfg in any text editor (such as Notepad)
4. Find and edit datadir=d:\\java\\tool\\zookeeper-3.4.6\\tmp
5. Similar to what is done in Java, we add the following in the system environment variable:
A. Adding Zookeeper_home = D:\Java\Tool\zookeeper-3.4.6 in System variables
B. Edit the path system variable and add it as path%zookeeper_home%\bin;
6. Modify the default zookeeper port in the Zoo.cfg file (default port 2181)
7. Open the new cmd, enter Zkserver, and run zookeeper.
8. Command-line prompts are as follows: Description of local zookeeper startup success
Third, installation and Operation Kafka
Download:
Http://kafka.apache.org/downloads.html. Note To download the binary version of the
Unzip to any directory after download f:/kafka_2.11-0.10.0.1
1. Enter the Kafka configuration directory, f:/kafka_2.11-0.10.0.1
2. Edit the file "Server.properties"
3. Find and edit Log.dirs=f:/kafka_2.11-0.10.0.1/kafka-log, where the catalogue itself is modified to its own liking
4. Locate and edit the zookeeper.connect=localhost:2181. Represents a local run
5. Kafka will run by default on port 9092 and connect to Zookeeper's default port: 2181.
Run:
Important: Make sure that the zookeeper instance is ready and running before you start the Kafka server.
1. Enter the Kafka installation directory f:/kafka_2.11-0.10.0.1
2. Press shift+ Right-click and select the "Open command Window" option to open the command line.
3. Now enter
./bin/windows/kafka-server-start.bat./config/server.properties
and enter
Iv. testing (Zookeeper and Kafka on the top)
(1). Create a Theme
1. Enter the Kafka installation directory D:\Java\Tool\kafka_2.11-0.10.0.1
2. Press shift+ Right-click and select the "Open command Window" option to open the command line.
3. Now enter
./bin/windows/kafka-console-consumer.bat--zookeeper localhost:2181--topic HelloWorld
and enter
(2) Create a producer
1. Enter the Kafka installation directory D:\Java\Tool\kafka_2.11-0.10.0.1
2. Press shift+ Right-click and select the "Open command Window" option to open the command line.
3. Now enter
./bin/windows/kafka-console-producer.bat--broker-list localhost:9092--topic HelloWorld
and enter
(3) Create a consumer
1. Enter the Kafka installation directory D:\Java\Tool\kafka_2.11-0.10.0.1
2. Press shift+ Right-click and select the "Open command Window" option to open the command line.
3. Now enter
./bin/windows/kafka-console-consumer.bat--zookeeper localhost:2181--topic HelloWorld
and enter
You can then enter the content in the producer window and press ENTER to see the message in the consumer window.
Install Kafka under Windows