Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

close Kafka via TERMINAL

Hi I'm newby Kafka and I succedded in starting a Kafka server in windows (via Terminal) follwing this documentation: https://dzone.com/articles/running-apache-kafka-on-windows-os https://kafka.apache.org/quickstart

My question is easy, how should I close KAfka correctly via cmd terminal in windows?

The problem is that when I close the different terminals (in order to shut down my computer) I'm not able to start it again beceause kafka runs out of memory and fataly crashes

 ERROR Error while loading log dir C:\Users\u1\Desktop\kafka-logs (kafka.log.LogManager)
java.io.IOException: Map failed
        at sun.nio.ch.FileChannelImpl.map(FileChannelImpl.java:944)
        at kafka.log.AbstractIndex.<init>(AbstractIndex.scala:126)
.
Caused by: java.lang.OutOfMemoryError: Map failed
        at sun.nio.ch.FileChannelImpl.map0(Native Method)
        at sun.nio.ch.FileChannelImpl.map(FileChannelImpl.java:941)

Is there any way to close my consumer, producer, topic, kafka and producer correctly using terminal comands?

enter image description here I found a lot of documentation about closing it via code but this is not my question. Closing a Kafka connection

-------- UPDATE------- I don´t know how to declare the winner of the solution because both (Robin Moffatt, Mukesh Prajapati) are right. Because when I press CTRL + C, my terminal asks me about closing the program that is executing. Also when I restart it, works perfectly. In the other hand the solution provided by Mukesh Prajapati also works like charm, as you can see in the following screen it closes the instance of the zookeper. (thanks both for your help) enter image description here

like image 214
MrPotatoServer Avatar asked Oct 26 '25 10:10

MrPotatoServer


2 Answers

To shutdown Zookeeper, use following command:

bin\windows\zookeeper-server-stop.bat config\zookeeper.properties

To shutdown Kafka Server, use following command:

bin\windows\kafka-server-stop.bat config\server.properties
like image 135
mukesh210 Avatar answered Oct 29 '25 01:10

mukesh210


You need to shut Kafka down gracefully. On Linux that would be with Ctrl-C in the terminal which sends a SIGINT to Kafka at which point it will shut down what it's doing and close its open files etc. I'm assuming the same will be true on Windows.

like image 44
Robin Moffatt Avatar answered Oct 29 '25 01:10

Robin Moffatt



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!