16

Every time I stop the kafka server and start it again it doesn't start properly and I have to restart my whole machine and start the kafka server. Does anybody know how I can restart kafka server without having to restart my machine? Actually I would like to terminate the consumer from last session.

Thank you,

Zeinab

Zeinab Akhavan
  • 323
  • 1
  • 2
  • 13

2 Answers2

20

If your Kafka broker is running as a service (found under /lib/systemd/system/) from a recent Confluent Platform release, you can stop it using:

systemctl stop confluent-kafka.service

or if you'd like to restart the service,

systemctl restart confluent-kafka.service

Otherwise, you can stop your broker using

./bin/kafka-server-stop.sh

and re-start it:

./bin/kafka-server-start.sh config/server.properties

If you want to stop a specific consumer, simply find the corresponding process id:

ps -ef | grep consumer_name

and kill that process:

kill -9 process_id
Giorgos Myrianthous
  • 36,235
  • 20
  • 134
  • 156
5

Or simply:

sudo systemctl restart kafka
Mattia Baldari
  • 567
  • 1
  • 5
  • 15