1 Kafka报错:
使用KAFKA的JAVA-API,远程连接kafka服务器,出现如下报错
Error while fetching metadata with correlation id 4 : {first2=LEADER_NOT_AVAILABLE}
Connection to node -1 could not be established. Broker may not be available.
1)Error while fetching metadata with correlation id 4 : {first2=LEADER_NOT_AVAILABLE}
2)onnection to node -1 could not be established. Broker may not be available.
2 原因可能有两个:
1 linux服务器主机名和ip未配置到windows下的hosts文件中,导致无法正常访问
解决办法:
打开C:\Windows\System32\drivers\etc\hosts
将linux服务器的ip和主机名映射关系配置到里面

2 kafka配置文件server.properties未正常配置,进行如下设置

指定主机的Ip和端口。注意:如果是kafka集群,这里的ip不同机器要填自己各自的ip
完成上述修改后,重启kafka集群,即可正常访问
本文介绍了在使用Kafka Java API时遇到的连接错误及其解决方法。主要错误为“LEADER_NOT_AVAILABLE”及“Broker may not be available”,通过配置Windows hosts文件和正确设置Kafka server.properties文件来解决。
8696

被折叠的 条评论
为什么被折叠?



