通过TERMINAL

时间:2019-03-22 11:22:40

标签: windows cmd apache-kafka

嗨,我是Kafka的新人,我成功通过以下文档在Windows中(通过终端)启动Kafka服务器: https://dzone.com/articles/running-apache-kafka-on-windows-os https://kafka.apache.org/quickstart

我的问题很简单,如何通过Windows中的cmd终端正确关闭KAfka?

问题是,当我关闭其他终端(以关闭计算机)时,由于kafka内存不足并严重崩溃而无法再次启动它

 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)

是否可以使用终端命令正确关闭我的消费者,生产者,主题,kafka和生产者?

enter image description here 我找到了很多有关通过代码关闭它的文档,但这不是我的问题。 Closing a Kafka connection

--------更新------- 我不知道如何宣布解决方案的胜利者,因为(罗宾·莫法特(Robin Moffatt),穆克什·普拉亚帕蒂(Mukesh Prajapati))都是正确的。因为当我按CTRL + C时,我的终端会问我有关关闭正在执行的程序的信息。另外,当我重新启动它时,它也可以正常工作。 另一方面,Mukesh Prajapati提供的解决方案也像魅力一样工作,正如您在以下屏幕中看到的那样,它关闭了Zookeper实例。 (感谢您的帮助) enter image description here

2 个答案:

答案 0 :(得分:1)

您需要正常关闭Kafka。 在Linux上,该终端带有Ctrl-C,它将向SIGINT发送到Kafka,这时它将关闭正在执行的操作并关闭其打开的文件等。我假设在Windows上也是如此

答案 1 :(得分:1)

要关闭Zookeeper,请使用以下命令:

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

要关闭Kafka Server,请使用以下命令:

bin\windows\kafka-server-stop.bat config\server.properties
相关问题