尝试在Apache Kafka上创建主题时出错

时间:2018-01-23 13:09:59

标签: apache-kafka

我正在尝试使用

创建一个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将解决此问题,但如何使用机架信息进行副本分配?

1 个答案:

答案 0 :(得分:1)

我想不是所有的经纪人都有机架配置。给密钥broker.rack grep你的server.properties。如果仅在某些但不是所有服务器配置中出现,则这是导致问题的原因。

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