Kafka 执行命令超时异常: Timed out waiting for a node assignment

06-15 1640阅读

Kafka 执行命令超时异常: Timed out waiting for a node assignment

问题描述:

搭建了一个kafka集群环境,在使用命令行查看已有topic时,报错如下:

[root@localhost bin]# kafka-topics.sh --list --bootstrap-server 192.168.135.132:9092,192.168.135.133:9092,192.168.135.134:9092
Error while executing topic command : Timed out waiting for a node assignment. Call: listTopics
[2024-05-08 20:39:59,123] ERROR org.apache.kafka.common.errors.TimeoutException: Timed out waiting for a node assignment. Call: listTopics
 (org.apache.kafka.tools.TopicCommand)

Kafka 执行命令超时异常: Timed out waiting for a node assignment

问题分析:

由于刚学习 kafka搭建集群,根据网上教程来,教程中三台kafka都部署在同一台机器上,所以不需要额外指定kafka实力的ip地址。

而我的环境是使用了三台虚拟机,分别部署了zookeeper和kafka,所以在没有指定的情况下,默认都是使用localhost,在执行命令的时候,会找不到对应的ip地址。

问题解决:

修改 kafka 配置文件:

/usr/local/kafka_2.12-3.7.0/config/server.properties

listeners=PLAINTEXT://192.168.135.132:9092

Kafka 执行命令超时异常: Timed out waiting for a node assignment

将三台机器的配置ip改为虚拟机ip地址。

修改保存后,再去重启kafka。

/usr/local/kafka_2.12-3.7.0/bin/kafka-server-stop.sh
/usr/local/kafka_2.12-3.7.0/bin/kafka-server-start.sh -daemon /usr/local/kafka_2.12-3.7.0/config/server.properties

通过在zookeeper上查看节点信息,

进入zookeeper客户端:

/usr/local/apache-zookeeper-3.8.4-bin/bin/zkCli.sh

查看kafka节点信息:

get /kafka/brokers/ids/1
get /kafka/brokers/ids/2
get /kafka/brokers/ids/3

Kafka 执行命令超时异常: Timed out waiting for a node assignment

其中ip信息也改成了真实ip信息。

到此,问题解决。

VPS购买请点击我

文章版权声明:除非注明,否则均为主机测评原创文章,转载或复制请以超链接形式并注明出处。

目录[+]