我们在我们的环境中使用 Kafka 2.10-0.9.0.2.4.2.0-258。我们在 kafka 控制台消费者的几个主题上遇到了以下异常。我知道有时进入这些主题的消息太大,但它们不会超过 message.max.bytes。
./kafka-console-consumer.sh --zookeeper xxx:2181,xxx:2181,xxx:2181 --topic test-topic
{metadata.broker.list=xxx:9092,xxx:9092,xxx:9092, request.timeout.ms=30000, client.id=console-consumer-76015, security.protocol=PLAINTEXT}
[2016-08-28 21:27:54,795] ERROR Error processing message, terminating consumer process: (kafka.tools.ConsoleConsumer$)
java.lang.IllegalArgumentException
at java.nio.Buffer.limit(Buffer.java:275)
at kafka.message.Message.sliceDelimited(Message.scala:237)
at kafka.message.Message.key(Message.scala:224)
at kafka.message.MessageAndMetadata.key(MessageAndMetadata.scala:30)
at kafka.consumer.OldConsumer.receive(BaseConsumer.scala:84)
at kafka.tools.ConsoleConsumer$.process(ConsoleConsumer.scala:109)
at kafka.tools.ConsoleConsumer$.run(ConsoleConsumer.scala:69)
at kafka.tools.ConsoleConsumer$.main(ConsoleConsumer.scala:47)
at kafka.tools.ConsoleConsumer.main(ConsoleConsumer.scala)
Processed a total of 0 messages
我按照下面的链接中的建议将replica.fetch.max.bytes减少为等于message.max.bytes,并将num.replica.fetchers减少到2,但它没有解决。
https://issues.apache.org/jira/browse/KAFKA-1196 https://issues.apache.org/jira/browse/KAFKA-1196
知道我还应该做什么才能让它发挥作用吗?
任何帮助,将不胜感激。
提前致谢。
我遇到了完全相同的问题。根本原因是您的 kafka 安装使用的 kafka jar 文件与您用于开发和运行生产者的 kafka jar 文件不兼容。您可以在 /usr/hdp/current/kafka-broker/libs 中找到您的安装使用的 kafka jar 版本
就我而言,我的 kafka 安装使用的是 kafka_2.10-0.9.0.2.4.2.0-258.jar,但我与制作人捆绑的 kafka jar 是 0.10.0.1。有一次,我切换到0.9.0.2.4.2.0-258,它有效。
如果您的集群是 HDP 并且您正在使用 Maven 来构建生产者,您可以在此处找到所有 jar 依赖项http://repo.hortonworks.com/content/repositories/releases/ http://repo.hortonworks.com/content/repositories/releases/
对于 Maven,您必须使用以下内容:
存储库:
<repositories>
<repository>
<id>org.hortonworks</id>
<url>http://repo.hortonworks.com/content/repositories/releases/</url>
</repository>
</repositories>
依赖关系:
<dependency>
<groupId>org.apache.kafka</groupId>
<artifactId>kafka_2.10</artifactId>
<version>0.9.0.2.4.2.0-258</version>
<scope>compile</scope>
<exclusions>
<exclusion>
<artifactId>jmxri</artifactId>
<groupId>com.sun.jmx</groupId>
</exclusion>
<exclusion>
<artifactId>jms</artifactId>
<groupId>javax.jms</groupId>
</exclusion>
<exclusion>
<artifactId>jmxtools</artifactId>
<groupId>com.sun.jdmk</groupId>
</exclusion>
</exclusions>
</dependency>
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)