lensesio / fast-data-dev

Kafka Docker for development. Kafka, Zookeeper, Schema Registry, Kafka-Connect, , 20+ connectors
https://lenses.io
Apache License 2.0
2.02k stars 331 forks source link

SSL gets duplicated on listeners config line at every restart. #127

Open unixunion opened 5 years ago

unixunion commented 5 years ago

Hi, when enabling SSL, and stopping and starting the docker-compose machine, the listeners config gets duplicated at https://github.com/Landoop/fast-data-dev/blob/9e83aa4152fa2b592aa23d50e6ebb9a158f6fb65/setup-and-run.sh#L423

This results in Kafka not starting as the SSL binding is more than one in the properties.

To reproduce, just enable SSL in docker-compose, start, stop and start again and Kafka will crash repeatedly with:

[2019-09-05 18:50:28,828] ERROR Exiting Kafka due to fatal exception (kafka.Kafka$) java.lang.IllegalArgumentException: requirement failed: Each listener must have a different port, listeners: PLAINTEXT://127.0.0.1:9092,SSL://127.0.0.1:9093,SSL://127.0.0.1:9093 at scala.Predef$.require(Predef.scala:277) at kafka.utils.CoreUtils$.validate$1(CoreUtils.scala:303) at kafka.utils.CoreUtils$.listenerListToEndPoints(CoreUtils.scala:314) at kafka.server.KafkaConfig.advertisedListeners(KafkaConfig.scala:1298) at kafka.server.KafkaConfig.validateValues(KafkaConfig.scala:1360) at kafka.server.KafkaConfig.<init>(KafkaConfig.scala:1338) at kafka.server.KafkaConfig.<init>(KafkaConfig.scala:1028) at kafka.server.KafkaConfig$.fromProps(KafkaConfig.scala:1008) at kafka.server.KafkaServerStartable$.fromProps(KafkaServerStartable.scala:28) at kafka.Kafka$.main(Kafka.scala:59) at kafka.Kafka.main(Kafka.scala)

gkhays commented 4 years ago

I'm seeing the same issue. I start up the container with docker-compose where the kafka service looks like this:

  kafka:
    image: lensesio/fast-data-dev:latest
    ports:
      - "2181:2181"
      - "3030:3030"
      - "8081-8083:8081-8083"
      - "9581-9585:9581-9585"
      - "9092:9092"
      - "9093:9093"
    environment:
      - ADV_HOST=${IP}
      - SAMPLEDATA=0
      - ENABLE_SSL=1
      - BROKER_SSL_CLIENT_AUTH="requested"
      - BROKER_SSL_ENDPOINT_IDENTIFICATION_ALGORITHM="https"
      - BROKER_SECURITY_PROTOCOL="SASL_SSL"
      - BROKER_SASL_MECHANISM="PLAIN"
      - BROKER_SASL_JAAS_CONFIG="org.apache.kafka.common.security.plain.PlainLoginModule"

As above, the log shows the following:

[2020-06-25 15:07:25,028] INFO Registered kafka:type=kafka.Log4jController MBean (kafka.utils.Log4jControllerRegistration$)
[2020-06-25 15:07:25,522] ERROR Exiting Kafka due to fatal exception (kafka.Kafka$)
java.lang.IllegalArgumentException: requirement failed: Each listener must have a different port, listeners: PLAINTEXT://10.204.132.21:9092,SSL://10.204.132.21:9093,SSL://10.204.132.21:9093
    at scala.Predef$.require(Predef.scala:281)
    at kafka.utils.CoreUtils$.validate$1(CoreUtils.scala:303)
    at kafka.utils.CoreUtils$.listenerListToEndPoints(CoreUtils.scala:314)
    at kafka.server.KafkaConfig.advertisedListeners(KafkaConfig.scala:1384)
    at kafka.server.KafkaConfig.validateValues(KafkaConfig.scala:1459)
    at kafka.server.KafkaConfig.<init>(KafkaConfig.scala:1437)
    at kafka.server.KafkaConfig.<init>(KafkaConfig.scala:1097)
    at kafka.server.KafkaConfig$.fromProps(KafkaConfig.scala:1077)
    at kafka.server.KafkaServerStartable$.fromProps(KafkaServerStartable.scala:28)
    at kafka.Kafka$.main(Kafka.scala:59)
    at kafka.Kafka.main(Kafka.scala)