启动Kafka经纪人时出错 [英] error while starting kafka broker

查看:41
本文介绍了启动Kafka经纪人时出错的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

昨天我成功地建立了Zookeeper和一名kafka经纪人.一切都按预期进行.我先关闭kafka(ctrl + c),然后再关闭zookeeper.

I was able to successfully set up zookeeper and one kafka broker yesterday. Everything worked as expected. I shut down kafka (ctrl + c) and then zookeeper.

今天我启动了zookeeper,并且当我启动kafka( bin/kafka-server-start.sh config/server0.properties )时,出现以下错误.我尝试了各种建议的补救措施(完全删除我的kafka安装并从头开始重新进行安装).我仍然遇到相同的错误.

Today I started zookeeper and when I started kafka (bin/kafka-server-start.sh config/server0.properties), I get the following error. I tried various remedies suggested (removing completely my kafka installation and doing it again from scratch). Still I get same error.

[2016-09-28 16:15:55,895] FATAL Fatal error during KafkaServerStartable startup. Prepare to shutdown (kafka.server.KafkaServerStartable)
java.lang.RuntimeException: A broker is already registered on the path /brokers/ids/0. This probably indicates that you either have configured a brokerid that is already in use, or else you have shutdown this broker and restarted it faster than the zookeeper timeout so it appears to be re-registering.
        at kafka.utils.ZkUtils.registerBrokerInZk(ZkUtils.scala:305)
        at kafka.utils.ZkUtils.registerBrokerInZk(ZkUtils.scala:291)
        at kafka.server.KafkaHealthcheck.register(KafkaHealthcheck.scala:70)
        at kafka.server.KafkaHealthcheck.startup(KafkaHealthcheck.scala:51)
        at kafka.server.KafkaServer.startup(KafkaServer.scala:244)
        at kafka.server.KafkaServerStartable.startup(KafkaServerStartable.scala:37)
        at kafka.Kafka$.main(Kafka.scala:67)
        at kafka.Kafka.main(Kafka.scala)
[2016-09-28 16:15:55,896] INFO [Kafka Server 0], shutting down (kafka.server.KafkaServer)

所有在Mac中设置

推荐答案

在设置kafka和zookeeper多节点集群时,我遇到了同样的问题.

I have faced the same issue while setting up the kafka and zookeeper multinode cluster.

根本原因:

由于Zookeeper集成需要一些时间来设置,因此当我们启动kafka代理时,所有Zookeeper节点可能尚未加入Zookeeper集成.

As zookeeper ensemble takes some time to setup so when we start kafka brokers, all zookeeper nodes might have not joined zookeeper ensemble yet.

因此,可能是一个kafka节点连接到尚未集成的Zookeeper节点.

So It may be the case that one kafka node connected to a zookeeper node which is not yet in the ensemble.

另一个原因可能是kafka经纪人被杀而不是被杀.当您杀死kafka进程或崩溃时,它不会正确关闭其zookeeper连接.

Another reason can be kafka broker is killed instead of stopped. When you kill your kafka process or it crashes and it does not close its zookeeper connection correctly.

解决方案:

为避免这种情况,请确保在启动kafka经纪人之前,您的Zookeeper集成已启动并运行.

To avoid this situation make sure your zookeeper ensemble is up and running before starting kafka brokers.

在Zookeeper和kafka代理服务的启动和停止之间添加适当的等待时间.

Add proper waits between zookeeper and kafka broker services start and stop.

这篇关于启动Kafka经纪人时出错的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆