返回到文章

采纳

编辑于 3年前

kafka报advertised.listeners listener names must be equal to or a subset of the ones defined in listeners.

kafka

我使用kafka 3.0.0的KRaft模式,安装kafka集群,报:

advertised.listeners listener names must be equal to or a subset of the ones defined in listeners. Found PLAINTEXT1. The valid options based on the current configuration are PLAINTEXT

错误详情:

[2021-09-28 10:49:01,849] INFO Registered kafka:type=kafka.Log4jController MBean (kafka.utils.Log4jControllerRegistration$)
[2021-09-28 10:49:02,284] INFO Setting -D jdk.tls.rejectClientInitiatedRenegotiation=true to disable client-initiated TLS renegotiation (org.apache.zookeeper.common.X509Util)
[2021-09-28 10:49:02,360] ERROR Exiting Kafka due to fatal exception (kafka.Kafka$)
java.lang.IllegalArgumentException: requirement failed: advertised.listeners listener names must be equal to or a subset of the ones defined in listeners. Found PLAINTEXT1. The valid options based on the current configuration are PLAINTEXT
    at scala.Predef$.require(Predef.scala:337)
    at kafka.server.KafkaConfig.validateValues(KafkaConfig.scala:1956)
    at kafka.server.KafkaConfig.<init>(KafkaConfig.scala:1897)
    at kafka.server.KafkaConfig.<init>(KafkaConfig.scala:1394)
    at kafka.Kafka$.buildServer(Kafka.scala:67)
    at kafka.Kafka$.main(Kafka.scala:87)
    at kafka.Kafka.main(Kafka.scala)

我的server.properties配置如下:

listeners=PLAINTEXT://172.21.0.1:9092
advertised.listeners=PLAINTEXT1://172.21.0.1:9091
listener.security.protocol.map=PLAINTEXT1:PLAINTEXT,PLAINTEXT:PLAINTEXT

请问我该如何解决?