在kafka_2.12-2.2.0中创建主题会导致“等待节点分配超时”错误

时间:2019-07-14 12:19:43

标签: apache-kafka

在Kafka中创建新主题时,有人知道如何解决此错误吗?

➜  kafka_2.12-2.2.0 bin/kafka-topics.sh --create --bootstrap-server localhost:9093 --replication-factor 2 --partitions 2 --topic user-tracking
Error while executing topic command : org.apache.kafka.common.errors.TimeoutException: Timed out waiting for a node assignment.
[2019-07-14 13:01:35,094] ERROR java.util.concurrent.ExecutionException: org.apache.kafka.common.errors.TimeoutException: Timed out waiting for a node assignment.
    at org.apache.kafka.common.internals.KafkaFutureImpl.wrapAndThrow(KafkaFutureImpl.java:45)
    at org.apache.kafka.common.internals.KafkaFutureImpl.access$000(KafkaFutureImpl.java:32)
    at org.apache.kafka.common.internals.KafkaFutureImpl$SingleWaiter.await(KafkaFutureImpl.java:89)
    at org.apache.kafka.common.internals.KafkaFutureImpl.get(KafkaFutureImpl.java:260)
    at kafka.admin.TopicCommand$AdminClientTopicService.createTopic(TopicCommand.scala:163)
    at kafka.admin.TopicCommand$TopicService.createTopic(TopicCommand.scala:134)
    at kafka.admin.TopicCommand$TopicService.createTopic$(TopicCommand.scala:129)
    at kafka.admin.TopicCommand$AdminClientTopicService.createTopic(TopicCommand.scala:157)
    at kafka.admin.TopicCommand$.main(TopicCommand.scala:60)
    at kafka.admin.TopicCommand.main(TopicCommand.scala)
Caused by: org.apache.kafka.common.errors.TimeoutException: Timed out waiting for a node assignment.
 (kafka.admin.TopicCommand$)

我已经安装了Java和Maven:

➜  kafka_2.12-2.2.0 mvn --v
Apache Maven 3.5.3 (3383a37b1f9e9b3bc3df5050n29c8cff9f215291; 2018-02-24T19:49:05Z)
Maven home: /Users/User1/Development/apache-maven-3.5.3
Java version: 1.8.0_192, vendor: Oracle Corporation
Java home: /Library/Java/JavaVirtualMachines/jdk1.8.0_192.jdk/Contents/Home/jre
Default locale: en_US, platform encoding: UTF-8
OS name: "mac os x", version: "10.14.3", arch: "x86_64", family: "mac"
➜  kafka_2.12-2.2.0 

我已经开始了Zookeeper: bin/zookeeper-server-start.sh config/zookeeper.properties

我已经启动了server-1: bin/kafka-server-start.sh config/server-1.properties

我确保server-1.properties正在侦听端口9093: listeners=PLAINTEXT://:9093

然后我尝试创建一个主题: bin/kafka-topics.sh --create --bootstrap-server localhost:9093 --replication-factor 2 --partitions 2 --topic user-tracking

1 个答案:

答案 0 :(得分:1)

您正确配置了listeners。以下应该可以解决问题:

listeners=PLAINTEXT://localhost:9093