Leader Not Available Kafka in Console Producer

前端 未结 24 2576
野趣味
野趣味 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:06

    I had kafka running as a Docker container and similar messages were flooding to the log.
    And KAFKA_ADVERTISED_HOST_NAME was set to 'kafka'.

    In my case the reason for error was the missing /etc/hosts record for 'kafka' in 'kafka' container itself.
    So, for example, running ping kafka inside 'kafka' container would fail with ping: bad address 'kafka'

    In terms of Docker this problem gets solved by specifying hostname for the container.

    Options to achieve it:

    • docker run --hostname ...
    • docker run -it --add-host ...
    • hostname in docker-compose
    • hostname in AWS EC2 Task Definition

提交回复
热议问题