You might not have created the systemd service for kafka. To do this, 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
And then run:
$ sudo systemctl start kafka
Hope this will help.
To know more about Kafka, get your Apache Kafka certification course today.
Thank You