Uploaded image for project: 'Kafka'
  1. Kafka
  2. KAFKA-4121

Allow creating broker listeners from hostname

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Resolved
    • Minor
    • Resolution: Duplicate
    • 0.10.0.1
    • None
    • config
    • None

    Description

      I'm attempting to start a docker container using the parameter:

      advertised.listeners = PLAINTEXT://dockercomposeproject_kafka_1:9092
      

      However, I get this error:

      kafka_1      | java.lang.IllegalArgumentException: Error creating broker listeners from 'PLAINTEXT://dockercomposeproject_kafka_1:9092': Unable to parse PLAINTEXT://dockercomposeproject_kafka_1:9092 to a broker endpoint
      kafka_1      | 	at kafka.server.KafkaConfig.validateUniquePortAndProtocol(KafkaConfig.scala:954)
      kafka_1      | 	at kafka.server.KafkaConfig.getAdvertisedListeners(KafkaConfig.scala:985)
      kafka_1      | 	at kafka.server.KafkaConfig.<init>(KafkaConfig.scala:927)
      kafka_1      | 	at kafka.server.KafkaConfig$.fromProps(KafkaConfig.scala:743)
      kafka_1      | 	at kafka.server.KafkaConfig$.fromProps(KafkaConfig.scala:740)
      kafka_1      | 	at kafka.server.KafkaServerStartable$.fromProps(KafkaServerStartable.scala:28)
      kafka_1      | 	at kafka.Kafka$.main(Kafka.scala:58)
      kafka_1      | 	at kafka.Kafka.main(Kafka.scala)
      

      My workaround is to set my envar (for a wurstmeister/kafka-docker container, which is unrelated to this ticket) to:

      KAFKA_ADVERTISED_LISTENERS=PLAINTEXT://`getent hosts dockercomposeproject_kafka_1 | awk '{ print $1 }'`:9092
      

      Which resolves to:

      advertised.listeners = PLAINTEXT://172.18.0.4:9092
      

      This advertised.listeners resolution allows my docker container to start as expected.

      Could sending in hostnames, instead of strict IP addresses, be supported for the advertised.listeners setting?

      Thanks!

      Attachments

        Issue Links

          Activity

            People

              Unassigned Unassigned
              j.casares Joaquin Casares
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: