Apache Kafka 0.8 log4j2.xml appender收到超时错误

时间:2017-03-10 04:36:10

标签: log4j apache-kafka appender

我需要使用log4j2.xml配置Kafka appender,设置工作正常本地,但服务器我收到以下错误。

本地卡夫卡:kafka_2.11-0.10.2.0

Kafka Appender:0.9.0.0 当地工作得很好。

服务器Kafka:0.8

Kafka Appender:0.9.0.0

在服务器上我收到以下错误:

2017-03-09 21:19:18,255 main ERROR Unable to write to Kafka [kafkaAppender] for appender [kafkaAppender]. java.util.concurrent.ExecutionException: org.apache.kafka.common.errors.TimeoutException: Failed to update metadata after 60000 ms.
        at org.apache.kafka.clients.producer.KafkaProducer$FutureFailure.<init>(KafkaProducer.java:730)
        at org.apache.kafka.clients.producer.KafkaProducer.doSend(KafkaProducer.java:483)
        at org.apache.kafka.clients.producer.KafkaProducer.send(KafkaProducer.java:430)
        at org.apache.kafka.clients.producer.KafkaProducer.send(KafkaProducer.java:353)
        at org.apache.logging.log4j.core.appender.mom.kafka.KafkaManager.send(KafkaManager.java:81)
        at org.apache.logging.log4j.core.appender.mom.kafka.KafkaAppender.append(KafkaAppender.java:85)
        at org.apache.logging.log4j.core.config.AppenderControl.tryCallAppender(AppenderControl.java:155)
        at org.apache.logging.log4j.core.config.AppenderControl.callAppender0(AppenderControl.java:128)
        at org.apache.logging.log4j.core.config.AppenderControl.callAppenderPreventRecursion(AppenderControl.java:119)
        at org.apache.logging.log4j.core.config.AppenderControl.callAppender(AppenderControl.java:84)
        at org.apache.logging.log4j.core.config.LoggerConfig.callAppenders(LoggerConfig.java:390)
        at org.apache.logging.log4j.core.config.LoggerConfig.processLogEvent(LoggerConfig.java:375)
        at org.apache.logging.log4j.core.config.LoggerConfig.log(LoggerConfig.java:359)
        at org.apache.logging.log4j.core.config.LoggerConfig.log(LoggerConfig.java:349)
        at org.apache.logging.log4j.core.config.AwaitCompletionReliabilityStrategy.log(AwaitCompletionReliabilityStrategy.java:63)
        at org.apache.logging.log4j.core.Logger.logMessage(Logger.java:146)
        at org.apache.logging.slf4j.Log4jLogger.log(Log4jLogger.java:376)
        at org.apache.commons.logging.impl.SLF4JLocationAwareLog.info(SLF4JLocationAwareLog.java:155)
        at org.springframework.boot.SpringApplication.logStartupProfileInfo(SpringApplication.java:665)
        at org.springframework.boot.SpringApplication.prepareContext(SpringApplication.java:353)
        at org.springframework.boot.SpringApplication.run(SpringApplication.java:313)
        at org.springframework.boot.SpringApplication.run(SpringApplication.java:1186)
        at org.springframework.boot.SpringApplication.run(SpringApplication.java:1175)
        at com.charter.kafka.proxy.app.ProxyApplication.main(ProxyApplication.java:21)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:498)
        at org.springframework.boot.loader.MainMethodRunner.run(MainMethodRunner.java:48)
        at org.springframework.boot.loader.Launcher.launch(Launcher.java:87)
        at org.springframework.boot.loader.Launcher.launch(Launcher.java:50)
        at org.springframework.boot.loader.JarLauncher.main(JarLauncher.java:51)
Caused by: org.apache.kafka.common.errors.TimeoutException: Failed to update metadata after 60000 ms.

2 个答案:

答案 0 :(得分:0)

您无法获取元数据,检查kafka群集是否已启动并且运行且没有连接问题

答案 1 :(得分:0)

我的不好,我为log4j2.xml中的额外空间写了bootstrap.servers属性的值,删除空格后,我可以连接到Kafka。感谢。