Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
cd /opt
wget http://apache-mirror.rbc.ru/pub/apache/kafka/0.10.1.0/kafka_2.11-0.10.1.0.tgz
tar xvzf kafka_2.11-0.10.1.0.tgz
ln -s kafka_2.11-0.10.1.0/ kafka
vi /etc/systemd/system/kafka-zookeeper.service
[Unit]
Description=Apache Zookeeper server (Kafka)
Documentation=http://zookeeper.apache.org
Requires=network.target remote-fs.target
After=network.target remote-fs.target
[Service]
Type=simple
User=nano
Group=nano
Environment=JAVA_HOME=/usr/java/jdk1.8.0_102
ExecStart=/opt/kafka/bin/zookeeper-server-start.sh /opt/kafka/config/zookeeper.properties
ExecStop=/opt/kafka/bin/zookeeper-server-stop.sh
[Install]
WantedBy=multi-user.target
vi /etc/systemd/system/kafka.service
[Unit]
Description=Apache Kafka server (broker)
Documentation=http://kafka.apache.org/documentation.html
Requires=network.target remote-fs.target
After=network.target remote-fs.target kafka-zookeeper.service
[Service]
Type=simple
User=nano
Group=nano
Environment=JAVA_HOME=/usr/java/jdk1.8.0_102
ExecStart=/opt/kafka/bin/kafka-server-start.sh /opt/kafka/config/server.properties
ExecStop=/opt/kafka/bin/kafka-server-stop.sh
[Install]
WantedBy=multi-user.target
vi kafka/config/server.properties
edit listeners propertie
listeners=PLAINTEXT://192.168.13.133:9092
systemctl daemon-reload
systemctl start kafka-zookeeper.service
systemctl start kafka.service
@stiv-yakovenko
Copy link

stiv-yakovenko commented Aug 9, 2018

very helpful, thank you so much!

@AndresPineros
Copy link

AndresPineros commented Feb 5, 2019

Thanks :)

@moiz01
Copy link

moiz01 commented May 5, 2019

thank you

@bugster86
Copy link

bugster86 commented May 8, 2019

Thank you!!

@arbabkhalil
Copy link

arbabkhalil commented Jun 13, 2019

Thank you :)

@bmshukla
Copy link

bmshukla commented Oct 17, 2019

User=nano & Group=nano
There is no "nano" found.
Should I create login "nano" in /etc/passwd and group "nano" in /etc/group ?

@vipmax
Copy link
Author

vipmax commented Nov 6, 2019

User=nano & Group=nano
There is no "nano" found.
Should I create login "nano" in /etc/passwd and group "nano" in /etc/group ?

no
change it to your username
nano its just in my case

@ptebraak
Copy link

ptebraak commented Mar 31, 2020

Thanks for posting this. I wonder how you add additional brokers to the service? Could you include an example of a service with 2 brokers?

@hillal20
Copy link

hillal20 commented Jun 16, 2020

@training1-rbcalonzo
Copy link

training1-rbcalonzo commented Oct 26, 2020

the "http://apache-mirror.rbc.ru/pub/apache/kafka/0.10.1.0/kafka_2.11-0.10.1.0.tgz" is not found

you can choose the version available in the mirror by visiting this link: http://apache-mirror.rbc.ru/pub/apache/kafka/

@izghitu
Copy link

izghitu commented Jan 21, 2021

thank you

@pythonzm
Copy link

pythonzm commented Mar 10, 2021

thank you

@glmonarch
Copy link

glmonarch commented Apr 7, 2021

Thx a lot!

@Torrakanor611
Copy link

Torrakanor611 commented Apr 24, 2021

is good, but if you are trying to setup a kafka broker in a remote machine were o only have a ssh conection to that machine, u should create another user and give him permissions to sudo, like explained in this guide:
https://www.digitalocean.com/community/tutorials/how-to-install-apache-kafka-on-ubuntu-20-04

@minalhk
Copy link

minalhk commented Jun 3, 2021

kafka.service - Apache Kafka Server
Loaded: loaded (/etc/systemd/system/kafka.service; disabled; vendor preset: enabled)
Active: failed (Result: exit-code) since Thu 2021-06-03 16:57:10 IST; 20s ago
Docs: http://kafka.apache.org/documentation.html
Process: 5376 ExecStart=/usr/local/kafka/bin/kafka-server-start.sh /usr/local/kafka/config/server.properties (code=exited, status=1/FAILURE)
Main PID: 5376 (code=exited, status=1/FAILURE)

Jun 03 16:57:10 minal systemd[1]: Started Apache Kafka Server.
Jun 03 16:57:10 minal kafka-server-start.sh[5376]: Classpath is empty. Please build the project first e.g. by running './gradlew jar -PscalaVe
Jun 03 16:57:10 minal systemd[1]: kafka.service: Main process exited, code=exited, status=1/FAILURE
Jun 03 16:57:10 minal systemd[1]: kafka.service: Failed with result 'exit-code'.

server is not starting and I'm getting this response when I check kafka status
If you could help

@weenxin
Copy link

weenxin commented Dec 15, 2021

thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment