【问题标题】:Cannot update metadata - Kafka Producer for Cloudera Quickstart VM无法更新元数据 - Cloudera 快速入门 VM 的 Kafka Producer
【发布时间】:2018-09-16 00:40:23
【问题描述】:

我刚刚安装了 Cloudera QuickStart VM 并为其添加了 Kafka 服务。添加 Kafka 服务后,我可以轻松创建生产者/消费者,一切都按预期工作。几天后重新启动虚拟机,我收到以下异常:

线程“main”java.util.concurrent.ExecutionException 中的异常:org.apache.kafka.common.errors.TimeoutException:60000 毫秒后更新元数据失败。 在 org.apache.kafka.clients.producer.KafkaProducer$FutureFailure.(KafkaProducer.java:1124) 在 org.apache.kafka.clients.producer.KafkaProducer.doSend(KafkaProducer.java:823) 在 org.apache.kafka.clients.producer.KafkaProducer.send(KafkaProducer.java:760) 在 org.apache.kafka.clients.producer.KafkaProducer.send(KafkaProducer.java:648) 在 test.kafka.KafkaProducerExample.runProducer(KafkaProducerExample.java:37) 在 test.kafka.KafkaProducerExample.main(KafkaProducerExample.java:54) 原因:org.apache.kafka.common.errors.TimeoutException: 60000 毫秒后更新元数据失败。

我尝试通过 telnet 连接到端口 9092,它可以正常工作。我能够从 QuickStart VM 内部发送消息。有什么建议吗?

【问题讨论】:

    标签: apache-kafka


    【解决方案1】:
    val record = new ProducerRecord[String, String](settings.topic, notification.tableName, notification.toJson())
        producer.send(record).**get**
    /**
         * Waits if necessary for at most the given time for the computation
         * to complete, and then retrieves its result, if available.
         *
         * @param timeout the maximum time to wait
         * @param unit the time unit of the timeout argument
         * @return the computed result
         * @throws CancellationException if the computation was cancelled
         * @throws ExecutionException if the computation threw an
         * exception
         * @throws InterruptedException if the current thread was interrupted
         * while waiting
         * @throws TimeoutException if the wait timed out
         */
    

    【讨论】:

      【解决方案2】:

      您可以尝试删除 zookeeper 日志以及您的 kafka 代理日志,然后尝试运行您的我认为它会起作用。它不起作用,因为它正在获取旧日志。您可以从 zookeeper.properties 和 server.properties 更改日志目录路径。

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        相关资源
        最近更新 更多