How To Install Bootstrap On Windows 10
Apache Kafka is a widely used and pop open up-source Event-Streaming & messaging system with capabilities to handle huge loads of data with its distributed, mistake tolerant architecture. In another Kafka tutorial, I covered Kafka Introduction, Kafka Basic Concepts and a high level overview of Kafka Architecture. In this Kafka tutorial, I will explain how to install Kafka on Windows, how to setup Kafka on Windows with a unmarried banker & ZooKeeper (unmarried node kafka cluster) and how to run kafka as a windows service in Windows 10. I volition also explain and demonstrate how to create Kafka topics, how to publish message to Kafka Topic and how to Consume bulletin from Kafka Topic.
Setup Kafka on Windows: Pre-Requisites for Installing Kafka on Windows OS
Java is the primary pre-requisite for installing and running Kafka. Install Java JDK 1.8 by downloading it from Official source (Oracle). Follow the instructions (sorcerer based steps) and complete Java Installation on your machine. In one case Java is installed successfully, you can verify by using the command: java -version as this control volition display details of your installed Java version if installation was completed correctly.
After that, set JAVA_HOME environment variable.
You lot need to add bin path to our Path variable besides.
Additionally, y'all should take some utility (east.g. 7zip) in order to unzip the setup once downloaded.
Step 1 Setting upwards Kafka on Windows: Download Kafka Setup
In guild to download Kafka setup, visit download page on Kafka site and download binary for Kafka. At the time of writing this Kafka tutorial, latest binary version bachelor is 2.half-dozen.0 and you can choose any scala version.
For a single node cluster bones setup, we don't demand to have a separate ZooKeeper setup every bit we will use ZooKeeper which is bachelor in aforementioned Kafka binaries.
Step two Setting up Kafka on Windows: Create Directory Structure for Kafka Server and Extract Kafka Binaries
One time your download for Kafka is completed, you need to excerpt Kafka Binaries in a folder to exist used as Kafka Home. Permit'south create a new binder in D drive (You can choose directory according to your own preferences) and unzip Kafka binaries in that folder. And so I will take my Kafka Setup extracted in D:\Kafka-ii.6.0 as shown below:
Now nosotros need to consider ZooKeeper and Kafka Properties files and make any changes if we need. For example, if we need to specify whatever custom locations to store logs and data instead of default temp folders, we tin do that. Let'due south create a data folder inside our Kafka binder and inside that create separate folders for Kafka and ZooKeeper to store Kafka logs and ZooKeeper information respectively.
Now, we demand to update configuration files to point to these newly created directories. To update Kafka configurations, open server.properties file and alter logs location to newly created directory every bit below:
log.dirs=D:/kafka-ii.half dozen.0/data/kafka
Similarly, we need to change data directory for ZooKeeper by updating Zookeeper.properties file as below:
dataDir= D:/kafka-2.6.0/data/zookeeper
Step iii Running Kafka on Windows: Outset Zookeeper on Windows
Now we need to showtime ZooKeeper outset in society to continue with subsequent steps to complete Kafka setup on our windows automobile. You lot can start zookeeper by running the bat script (zookeeper-server-start.bat) which is available within bin\windows directory. In order to run zookeeper using this bat file, y'all will need to specify zookeeper configuration backdrop file as an argument equally beneath:
Start cd to D:\Kafka-ii.6.0\bin\windows and then run:
zookeeper-server-first.bat ..\..\config\zookeeper.properties
Once zookeeper has started successfully, we can proceed with our next step to first kafka broker.
Step 3 Running Kafka on Windows: Showtime Kafka Broker on Windows
While keeping the zookeeper running, open another terminal and run Kafka banker using below command past specifying configuration properties file as an argument:
First cd to D:\Kafka-ii.six.0\bin\windows and so run:
kafka-server-start.bat ..\..\config\server.properties
One time Apache Kafka (kafka Broker) has started successfully, nosotros can go on with the stride to create kafka topic and testing message pub/sub events.
Stride 4 Running Kafka on Windows: Create Kafka Topic
Kafka messages are stored in topics. Topics are virtual containers for the messages and pub/sub mechanism of Kafka server works using Kafka Topics. Kafka topic is basically a virtual grouping of one or more than Kafka partitions in a cluster.
In order to create kafka topic, we volition utilize below control (afterward cd to bin\windows directory):
kafka-topics.bat –create –topic tutorialspedia –bootstrap-server localhost:9092
Using above command, we created a topic with the proper noun tutorialspedia. Delight notation that for bootstrap-server, you need to specify host and port as per your banker configurations. By default kafka banker runs on port 9092
You lot can verify created topic by running the command below which will list all bachelor topics in your kafka server:
kafka-topics.bat –list –bootstrap-server localhost:9092
Step five Running Kafka on Windows: Publish Message to Kafka Topic
Open another terminal (with Kafka Banker and ZooKeeper running separately), and utilize below control to publish messages to our Kafka topic that was created in previous footstep:
kafka-panel-producer.bat –topic tutorialspedia –bootstrap-server localhost:9092
Send a few messages to the topic and in another terminal, we will run a consumer (subscriber) to read the messages from the topic.
Step half-dozen Running Kafka on Windows: Subscribe Bulletin to Kafka Topic
Run below command to start a consumer/subscriber for the kafka topic and start reading the messages:
kafka-panel-consumer.bat –topic tutorialspedia –bootstrap-server localhost:9092
Test by sending few more letters from publisher last and you lot should exist able to receive those letters immediately in consumer last.
How to Run Kafka As a Windows Service?
In this Kafka Tutorial, we are running Kafka Broker, Zookeeper and other scripts for creating topics, publishing messages to a topic and consuming bulletin from a topic by opening carve up terminals. What if we desire to run our kafka server as a windows service? In this section I will explain how to install Kafka as a Windows Service. To be precise, you lot volition acquire how to run Kafka broker as a windows service and too how to run Kafka zookeeper as a windows service.
In order to install Kafka every bit Windows service, I volition use a unproblematic yet powerful utility known as NSSM (Non-Sucking Service Manager). We will apply NSSM to create Windows Service for Kafka Banker and ZooKeeper.
Download NSSM and so install Kafka ZooKeeper every bit a service past running below command:
nssm install "Kafka Zookeeper"
A new window will open up where you demand to browse and chose D:\Kafka-2.6.0\bin\windows\zookeeper-server-start.bat and for arguments provide path to the configuration backdrop file (zookeeper.properties)
Service will go created and you will be able to see it in Services.
But get-go the service. (Please brand sure that zookeeper is stopped from the terminal which yous ran in previous steps earlier running it as a Windows Service to avoid port binding bug).
Side by side, we will run Kafka Broker every bit Windows Service past running below nssm command:
nssm install "Kafka Banker"
A new window will open where you demand to browse and chose D:\Kafka-two.6.0\bin\windows\kafka-server-start.bat and for arguments provide path to the configuration properties file (server.properties )
Only outset the service. (Please make certain that kafka broker is stopped from the terminal which you ran in previous steps before running it as a Windows Service to avert port binding issues).
At present y'all take both zookeeper and Kafka broker running equally Windows Services. Test by publishing some letters from Publisher terminal and verify that consumer terminal is able to receive the messages.
Source: https://tutorialspedia.com/how-to-setup-kafka-on-windows-install-and-run-kafka-as-windows-service/
Posted by: kimberlincren1949.blogspot.com

0 Response to "How To Install Bootstrap On Windows 10"
Post a Comment