尝试在 Apache Kafka 上创建主题时出错 [英] Error when trying to create a topic on Apache Kafka

查看:23
本文介绍了尝试在 Apache Kafka 上创建主题时出错的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试使用

$KAFKA_HOME/bin/kafka-topics.sh --create --zookeeper localhost:2181 --replication-factor 1 --partitions 1 --topic testing

但是报如下错误:

Error while executing topic command : Not all brokers have rack information. Add --disable-rack-aware in command line to make replica assignment without rack information.
[2018-01-23 15:03:44,471] ERROR kafka.admin.AdminOperationException: Not all brokers have rack information. Add --disable-rack-aware in command line to make replica assignment without rack information.
    at kafka.admin.AdminUtils$.getBrokerMetadatas(AdminUtils.scala:443)
    at kafka.admin.AdminUtils$.createTopic(AdminUtils.scala:461)
    at kafka.admin.TopicCommand$.createTopic(TopicCommand.scala:110)
    at kafka.admin.TopicCommand$.main(TopicCommand.scala:63)
    at kafka.admin.TopicCommand.main(TopicCommand.scala)
 (kafka.admin.TopicCommand$)

两个zookeeper

$KAFKA_HOME/bin/zookeeper-server-start.sh $KAFKA_HOME/config/zookeeper.properties 

kafka-server

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

已成功启动.

添加--disable-rack-aware 可以解决这个问题,但是如何使用机架信息进行副本分配?

Addition of --disable-rack-aware will solve this issue but how can I make replica assignment with rack information?

推荐答案

我想并不是所有的 broker 都有机架配置.为 key broker.rack 搜索你的 server.properties.如果这仅出现在部分而非全部服务器配置中,这就是问题的原因.

I guess not all of your brokers have a rack configuration. Grep your server.properties for the key broker.rack. If this appears only in some but not all of your server configurations this is the cause of your problem.

您可以在此处找到有关 kafka 机架感知的更多详细信息:https://community.hortonworks.com/questions/71458/can-anyone-explain-kafka-rack-awareness-feature.html

Here you can find some more details about kafka's rack awareness: https://community.hortonworks.com/questions/71458/can-anyone-explain-kafka-rack-awareness-feature.html

这篇关于尝试在 Apache Kafka 上创建主题时出错的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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