Leader Not Available Kafka in Console Producer

前端 未结 24 2638
野趣味
野趣味 2020-12-07 07:47

I am trying to use Kafka.
All configurations are done properly but when I try to produce message from console I keep getting the following error

WARN Err         


        
24条回答
  •  渐次进展
    2020-12-07 08:09

    The advertised listeners as mentioned in the above answers could be one of the reason. The other possible reasons are:

    1. The topic might not have been created. You can check this using bin/kafka-topics --list --zookeeper :
    2. Check your bootstrap servers that you have given to the producer to fetch the metadata. If the bootstrap server does not contain the latest metadata about the topic (for example, when it lost its zookeeper claim). You must be adding more than one bootstrap servers.

    Also, ensure that you have the advertised listener set to IP:9092 instead of localhost:9092. The latter means that the broker is accessible only through the localhost.

    When I encountered the error, I remember to have used PLAINTEXT://: in the list of bootstrap servers (or broker list) and it worked, strangely.

    bin/kafka-console-producer --topic sample --broker-list PLAINTEXT://:
    

提交回复
热议问题