Set the partitions options as the number of brokers you want your data to be split between. As we are running with a single instance keep this value 1. The replication-factor describes how many copies of data will be created. First, create a topic named “testTopic” with a single partition with single replica: cd /usr/local/kafkaīin/kafka-topics.sh -create -bootstrap-server localhost:9092 -replication-factor 1 -partitions 1 -topic testTopic Kafka provides multiple pre-built shell script to work on it. The part of this tutorial will help you to work with the Kafka server. The Kafka installation has been successfully completed. Now start the Kafka server and view the running status: sudo systemctl start kafkaĪll done. Use the systemctl command to start a single-node ZooKeeper instance. Step 4 – Start Kafka and Zookeeper Serviceįirst, you need to start ZooKeeper service and then start Kafka. Reload the systemd daemon to apply new changes. Įnvironment="JAVA_HOME=/usr/lib/jvm/java-1.11.0-openjdk-amd64"ĮxecStart=/usr/local/kafka/bin/kafka-server-start.sh /usr/local/kafka/config/server.propertiesĮxecStop=/usr/local/kafka/bin/kafka-server-stop.sh Make sure to set the correct JAVA_HOME path as per the Java installed on your system. Next, to create a systemd unit file for the Kafka service: vim /etc/systemd/system/rviceĪdd the below content. Which will help you to start/stop the Kafka service in an easy way.įirst, create a systemd unit file for Zookeeper: vim /etc/systemd/system/rviceĮxecStart=/usr/local/kafka/bin/zookeeper-server-start.sh /usr/local/kafka/config/zookeeper.propertiesĮxecStop=/usr/local/kafka/bin/zookeeper-server-stop.sh Now, you need to create systemd unit files for the Zookeeper and Kafka services.
Then extract the archive file tar xzf kafka_2.13-3.2.0.tgz sudo mv kafka_2.13-3.2.0 /usr/local/kafka Step 3 – Creating Systemd Unit Files You can also select any nearby mirror to download.
OpenJDK 64-Bit Server VM (build 11.0.9.1+1-Ubuntu-0ubuntu1.20.04, mixed mode, sharing)ĭownload the Apache Kafka binary files from its official download website. As we know, the Oracle java is now commercially available, So we are using its open source version OpenJDK.Įxecute below command to install OpenJDK on your system from the official PPA’s. In order to setup Kafka on Ubuntu system, you need to install java first. Step 1 – Installing JavaĪpache Kafka can be run on all platform supported Java. You must have sudo privileged account access to the Ubuntu 20.04 Linux system. You will also learn to create topics in Kafka and run producer and consumer nodes. This tutorial described you step by step tutorial to install Apache Kafka on Ubuntu 20.04 LTS Linux system. You can install Kafka on any platform supported Java. This is written in Scala and Java programming languages.
Apache Kafka is an open-source, distributed event streaming platform developed by the Apache Software Foundation.