java.lang.IllegalArgumentException:未知的压缩类型ID:5

时间:2019-01-31 10:21:58

标签: apache-kafka

尝试从Kafka读取时出现以下错误

java.lang.IllegalArgumentException: Unknown compression type id: 5
at org.apache.kafka.common.record.CompressionType.forId(CompressionType.java:46)
at org.apache.kafka.common.record.Record.compressionType(Record.java:260)
at org.apache.kafka.common.record.LogEntry.isCompressed(LogEntry.java:89)
at org.apache.kafka.common.record.RecordsIterator.makeNext(RecordsIterator.java:70)
at org.apache.kafka.common.record.RecordsIterator.makeNext(RecordsIterator.java:34)
at org.apache.kafka.common.utils.AbstractIterator.maybeComputeNext(AbstractIterator.java:79)
at org.apache.kafka.common.utils.AbstractIterator.hasNext(AbstractIterator.java:45)
at org.apache.kafka.clients.consumer.internals.Fetcher.parseCompletedFetch(Fetcher.java:772)
at org.apache.kafka.clients.consumer.internals.Fetcher.fetchedRecords(Fetcher.java:473)
at org.apache.kafka.clients.consumer.KafkaConsumer.pollOnce(KafkaConsumer.java:1038)
at org.apache.kafka.clients.consumer.KafkaConsumer.poll(KafkaConsumer.java:995)
at org.apache.flink.streaming.connectors.kafka.internal.KafkaConsumerThread.run(KafkaConsumerThread.java:243)

有什么想法吗?我应该去哪里看看?

2 个答案:

答案 0 :(得分:1)

由于客户端版本不兼容以及在旧版本的kafka上创建的主题,我也遇到了同样的问题。

检查您的kafka客户客户端版本和kafka版本。

答案 1 :(得分:0)

Kafka支持以下压缩编解码器- NONE,GZIP,SNAPPY,LZ4,ZSTD 。压缩类型介于0-4之间(也将在下面的链接中描述

https://github.com/apache/kafka/blob/trunk/clients/src/main/java/org/apache/kafka/common/record/CompressionType.java#L169

如果您使用的压缩编码解码器以外的其他压缩编码解码器,则需要将其更改为Kafka支持的压缩编码解码器。