【问题标题】:Issues running apache Kafka on Mac在 Mac 上运行 apache Kafka 的问题
【发布时间】:2021-07-11 01:01:15
【问题描述】:

我在我的 ma​​cOS Big Sur 11.1 上安装了 Apache Zookeeper 和 Apache Kafka (kafka_2.13-2.7.0)。 Zookeeper 运行良好但 Kafka 运行良好的地方。

Java 版本:

openjdk 14.0.2 2020-07-14
OpenJDK Runtime Environment AdoptOpenJDK (build 14.0.2+12)
OpenJDK 64-Bit Server VM AdoptOpenJDK (build 14.0.2+12, mixed mode, sharing)

我正在关注这个get started page。 zookeeper 运行良好,但是当我尝试运行 Kafka 时,它给了我以下错误。

MacBook-Pro:kafka saad$ bin/kafka-server-start.sh config/server.properties
[2021-04-16 06:19:56,021] INFO Registered kafka:type=kafka.Log4jController MBean (kafka.utils.Log4jControllerRegistration$)
[2021-04-16 06:19:56,450] INFO Setting -D jdk.tls.rejectClientInitiatedRenegotiation=true to disable client-initiated TLS renegotiation (org.apache.zookeeper.common.X509Util)
[2021-04-16 06:19:56,465] ERROR Exiting Kafka due to fatal exception (kafka.Kafka$)
java.lang.IllegalArgumentException: Error creating broker listeners from 'PLAINTEXT:localhost:9092': Unable to parse PLAINTEXT:localhost:9092 to a broker endpoint
    at kafka.utils.CoreUtils$.listenerListToEndPoints(CoreUtils.scala:274)
    at kafka.server.KafkaConfig.advertisedListeners(KafkaConfig.scala:1703)
    at kafka.server.KafkaConfig.validateValues(KafkaConfig.scala:1778)
    at kafka.server.KafkaConfig.<init>(KafkaConfig.scala:1756)
    at kafka.server.KafkaConfig.<init>(KafkaConfig.scala:1312)
    at kafka.server.KafkaServerStartable$.fromProps(KafkaServerStartable.scala:34)
    at kafka.Kafka$.main(Kafka.scala:68)
    at kafka.Kafka.main(Kafka.scala)
Caused by: org.apache.kafka.common.KafkaException: Unable to parse PLAINTEXT:localhost:9092 to a broker endpoint
    at kafka.cluster.EndPoint$.createEndPoint(EndPoint.scala:57)
    at kafka.utils.CoreUtils$.$anonfun$listenerListToEndPoints$6(CoreUtils.scala:271)
    at scala.collection.StrictOptimizedIterableOps.map(StrictOptimizedIterableOps.scala:99)
    at scala.collection.StrictOptimizedIterableOps.map$(StrictOptimizedIterableOps.scala:86)
    at scala.collection.mutable.ArraySeq.map(ArraySeq.scala:38)
    at kafka.utils.CoreUtils$.listenerListToEndPoints(CoreUtils.scala:271)
    ... 7 more

我试图从错误中得到一个想法,但由于我不是 java 人,所以我无法理解

【问题讨论】:

    标签: java apache-kafka


    【解决方案1】:

    我能够通过Kafka 问题线程解决问题。由于我没有在 docker 上运行服务器,因此也很难找到解决方案。

    问题基本上是使用严格的本地主机 IP 地址(我对此不太确定)。只需更改kafka/config目录中的严格ipserver.properties即可。

    # Hostname and port the broker will advertise to producers and consumers. If not set, 
    # it uses the value for "listeners" if configured.  Otherwise, it will use the value
    # returned from java.net.InetAddress.getCanonicalHostName().
    advertised.listeners=PLAINTEXT://localhost:9092
    

    【讨论】:

    • 一般来说,adverted listener应该是外部的hostname/ip,如果要使用其他机器,不是localhost
    猜你喜欢
    • 1970-01-01
    • 2020-06-09
    • 2021-05-20
    • 1970-01-01
    • 2011-10-04
    • 2014-12-19
    • 2011-01-22
    • 2011-09-29
    • 1970-01-01
    相关资源
    最近更新 更多