Apache Kafka is basically an open-source application and is primarily used for collecting big data, real-time streams, or both. Apache Kafka is working as a messaging system that informs users to send messages between servers, processors, and applications. In addition, by using Apache Kafka software, users can quickly, collect, define data and save them for future use.
In recent days, the demand for Apache Kafka software has increased after every passing day. Currently, more than the top 500 MNC start utilizing Apache software. Besides, MNCs, such as Netflix, LinkedIn, and Microsoft utilize four-comma messages per day with Apache Kafka.
In this article, we will walk you through the download and installation process of Apache Kafka software. Moreover, most importantly how you can run this excellent software on your Windows.
Download, Install, and Run Apache Kafka Software on Windows
In the rest of the content, we explained all the vital actions to download, install and run Apache software on your Operating System.
- Download the Necessary Files
At first, you must have to download all the necessary files from their official website, such as:
- Visit http://www.oracle.com/technetwork/java/javase/downloads/jre8-downloads-2133155.html and as per your Operating System and CPU architecture, download the JRE Server
- Download 7-Zip from http://www.7-zip.org/download.html and install it on your device.
- Visit http://zookeeper.apache.org/releases.html and from there, download as well as extract Zookeeper
- Finally, visit the official website of Apache Kafka http://kafka.apache.org/downloads.html and download as well as extract Apache Kafka.
Note: If you want to explore your career potential in Apache Kafka, then Enroll for Apache Kafka Training in MindMajix
Once you have successfully downloaded all the necessary files, it is time to install Apache Kafka on your Windows. Here are the steps that need to be followed:
- JDK Setup
Open the JDK downloaded file and click on the ‘Change destination folder option. After that, hit the Install button. Now, follow the given directions:
- The next thing you have to do is to change the installation directory
- Head to the Control Panel> System> Advanced System Settings> Environment Variables and open the system environment
- Go to the User variables section and tap on the New User Variable option. Enter ‘JAVA_ Home’ as the Variable name. Tap on the Enter option.
- Switch to the System variable Section and search for a Path variable within the Environment Variables box that you have just opened.
- Edit the variable path and enter ‘%JAVA_HOME%\bin’ at the text end.
- For confirmation, you should open CMD and enter ‘java version’ within the given field. After that, you will see the Java version you just installed.
- Install Zookeeper
After installing JDK, you must install the downloaded Zookeeper to your Windows. Check out the following points:
- Open the ZooKeeper configuration directory and rename the file from ‘zoo_sample.cfg to zoo.cfg’
- Now, you must open zoo.cfg within any text editor. For example, Notepad
- Go to System Environment Variables and add an entry as we did for Java
- Then, within the System Variables, add ‘ZOOKEEPER_HOME = C:\zookeeper-3.4.7’
- Rename the System Variable as Path as well as add; ‘%ZOOKEEPER_HOME%\bin;’
- Open a new CMD. Enter ‘zkserver’ within the input field. This will run the ZooKeeper.
Within a couple of minutes, you will see a ‘successful’ message on the computer screen rotating ‘Congratulations’.
- Kafka Set up
Here is how to install Apache Kafka on your Operating System:
- Proceed to the Kafka config directory. For example, ‘C:\kafka_2.11-0.9.0.0\config’
- Edit ‘ server.properties’ file
- The next task that you have to perform is to locate and edit the ‘log.dirs=/tmp/kafka-logs” to “log.dir= C:\kafka_2.11-0.9.0.0\kafka-logs’
Bear in mind, Apache Kafka software will connect to Zookeeper’s default port 2181 and it will run on default port 9092.
- Run a Kafka Server
Keep in mind, before running an Apache Kafka server; make sure that the Zookeeper instance is up. Read on…
- Head to the Kafka installation folder: ‘C:\kafka_2.11-0.9.0.0\’
- Open a command prompt and enter ‘ .\bin\windows\kafka-server-start.bat .\config\server.properties’ within the given field. Furthermore, click on the OK button.
- If everything is OK, you will see a confirmation message on the LED display.
Once done! You will be able to run the Apache Kafka software on Windows and can create topics in order to store messages. Apart from this, you can even directly consume data from Scala code or java from the Command Prompt.
- Create Topics
As there is only one Kafka server running, as per your requirement, you can increase the replication factor. It will act as a fault-tolerant system and raise data availability. Now, the following points will help you to create a new topic:
- Go to the directory ‘C:\kafka_2.11-0.9.0.0\bin\windows’ and open a new command prompt.
- Type ‘Kafka-topics.bat –create –zookeeper localhost:2181 –replication-factor 1 –partitions 1 –topic test’ within the command prompt and click on the Enter button.
- Create a Producer & Consume Test Server
After creating a new topic, follow the undermentioned points in order to create and consume the test server.
- Visit the location, ‘C:\kafka_2.11-0.9.0.0\bin\windows’ and then you should open a new command prompt.
- Enter ‘Kafka-console-producer.bat –broker-list localhost:9092 –topic test’ in the input field as well as press the Enter key. This will start a producer type.
- Again, you need to open a new command prompt and enter the given command.
‘Kafka-console-consumer.bat –bootstrap-server localhost:9092 –topic test’ and click on OK.
- Enter anything within the command prompt and click on the Enter button. Now, if on the consumer side, you see your messages, it indicates that you have successfully installed and run Apache Kafka software on your Windows.
Run Apache Kafka on Windows
As said earlier, through Apache Kafka software, you can collect data from different sources, define them, as well as save them for future usage. In this passage, we will try to cover all the possible aspects of Apache Kafka software, including the tactics to run this software on your device. Henceforth, you should apply the above-mentioned steps one after another and run the Run Apache software on your Windows.