Installing Kafka on Ubuntu

0 votes
Hello. Is there an easy way to install Kafka in Ubuntu?
Feb 21 in Apache Kafka by Girish
53 views

1 answer to this question.

0 votes

I am not sure what you expect by easy way. But here are the steps to install Kafka:

You can install Kafka with the help of Zookeeper(installation link here).

First, we need to get the kafka files. You can download it from the following website:

https://kafka.apache.org/downloads

Extract the file using:

$ tar -xvf kafka-2.1.1-src.tgz

Next, you have to configure kafka server

In the kafka directory, search for server.properties and open it with a text editor:

$ cd /kafka-2.1.1-src/config/

$ nano server.properties

Add the following line at the end of the file:

delete.topic.enable = true

This will allow us to delete kafka topic (it is disabled by default)

Next, open the zookeeper.service file:

$ sudo nano /etc/systemd/system/zookeeper.service

And add the below entries:

[Unit]

Requires=network.target remote-fs.target

After=network.target remote-fs.target


[Service]

Type=simple

User=kafka

ExecStart=/home/kafka/kafka/bin/zookeeper-server-start.sh /home/kafka/kafka/config/zookeeper.properties

ExecStop=/home/kafka/kafka/bin/zookeeper-server-stop.sh

Restart=on-abnormal


[Install]

WantedBy=multi-user.target

And finally, create systemd service:

Open the kafka.service file:

$ sudo nano /etc/systemd/system/kafka.service

And add the following entries:

[Unit]

Requires=zookeeper.service

After=zookeeper.service


[Service]

Type=simple

User=kafka

ExecStart=/bin/sh -c '/home/kafka/kafka/bin/kafka-server-start.sh /home/kafka/kafka/config/server.properties > /home/kafka/kafka/kafka.log 2>&1'

ExecStop=/home/kafka/kafka/bin/kafka-server-stop.sh

Restart=on-abnormal


[Install]

WantedBy=multi-user.target

Lastly, to start kafka service, run:

$ sudo systemctl start kafka
answered Feb 21 by Arun

Related Questions In Apache Kafka

0 votes
1 answer

Is there any change in consumer offsets if a new partition(s) is added to a Kafka topic?

Yes, it stays the same. An offset is ...READ MORE

answered Jul 9, 2018 in Apache Kafka by nitinrawat895
• 10,070 points
209 views
0 votes
1 answer

Kafka topic not being deleted

By default in Kafka version 0.10, delete.topic.enable ...READ MORE

answered Jul 9, 2018 in Apache Kafka by nitinrawat895
• 10,070 points
463 views
0 votes
1 answer

Re-balancing error while reading messages from Kafka.

rebalance.backoff.ms defines the time for which Kafka ...READ MORE

answered Jul 9, 2018 in Apache Kafka by Shubham
• 13,110 points
347 views
0 votes
10 answers

Writing the Kafka consumer output to a file

System.out.println(String.valueOf(output.offset()) + ": " + new String(bytes, ...READ MORE

answered Dec 7, 2018 in Apache Kafka by Harsh
4,623 views
0 votes
1 answer

Not able to fetch messages from Kafka cluster

You need to add the hostname in ...READ MORE

answered Jul 9, 2018 in Apache Kafka by Shubham
• 13,110 points
437 views
0 votes
1 answer

How to reset the offset of messages consumed from Kafka?

The reset option only prints the result ...READ MORE

answered Jul 9, 2018 in Apache Kafka by Shubham
• 13,110 points
1,737 views
0 votes
1 answer

Hadoop Mapreduce word count Program

Firstly you need to understand the concept ...READ MORE

answered Mar 16, 2018 in Data Analytics by nitinrawat895
• 10,070 points
2,038 views
0 votes
1 answer

hadoop.mapred vs hadoop.mapreduce?

org.apache.hadoop.mapred is the Old API  org.apache.hadoop.mapreduce is the ...READ MORE

answered Mar 16, 2018 in Data Analytics by nitinrawat895
• 10,070 points
192 views
0 votes
10 answers

hadoop fs -put command?

copy command can be used to copy files ...READ MORE

answered Dec 7, 2018 in Big Data Hadoop by Sujay
10,392 views
0 votes
1 answer

Hadoop dfs -ls command?

In your case there is no difference ...READ MORE

answered Mar 16, 2018 in Big Data Hadoop by kurt_cobain
• 9,240 points
762 views