生产者无法发送消息,ERROR Error when sending message to topic adon with key: null, value: 0 bytes?

点滴回忆 发表于: 2019-03-12   最后更新时间: 2021-09-06 19:38:21   10,318 游览

生产者发送消息报错,发送失败

错误信息如下:

[root@localhost kafka_2.12-2.1.1]# ./bin/kafka-console-producer.sh --broker-list 192.168.204.4:9092 --topic adon
>1
>[2019-03-12 10:13:10,894] WARN [Producer clientId=console-producer] Got error produce response with correlation id 3 on topic-partition adon-0, retrying (2 attempts left). Error: CORRUPT_MESSAGE (org.apache.kafka.clients.producer.internals.Sender)
[2019-03-12 10:13:10,995] WARN [Producer clientId=console-producer] Got error produce response with correlation id 4 on topic-partition adon-0, retrying (1 attempts left). Error: CORRUPT_MESSAGE (org.apache.kafka.clients.producer.internals.Sender)
[2019-03-12 10:13:11,101] WARN [Producer clientId=console-producer] Got error produce response with correlation id 5 on topic-partition adon-0, retrying (0 attempts left). Error: CORRUPT_MESSAGE (org.apache.kafka.clients.producer.internals.Sender)
[2019-03-12 10:13:11,210] ERROR Error when sending message to topic adon with key: null, value: 1 bytes with error: (org.apache.kafka.clients.producer.internals.ErrorLoggingCallback)
org.apache.kafka.common.errors.CorruptRecordException: This message has failed its CRC checksum, exceeds the valid size, has a null key for a compacted topic, or is otherwise corrupt.

kafka开启了

host.name=192.168.204.4
listeners=PLAINTEXT://192.168.204.4:9092
zookeeper.connect=192.168.204.4:2181

zookeeper zoo.cfg 开启了 
server.1=192.168.204.4:2888:3888

kafka 创建主题

./bin/kafka-topics.sh --create --zookeeper 192.168.204.4:2181 --replication-factor 1 --partitions 3 --topic adon --config cleanup.policy=compact --config retention.ms=1000

问题:生产者发送消息报错,发送失败

发表于 2019-03-12
添加评论

压缩策略为cleanup.policy=compact的情况下,key不能为空

你的答案

查看kafka相关的其他问题或提一个您自己的问题