【发布时间】:2020-01-05 03:27:09
【问题描述】:
我在我的 kafka 集群中创建了一个日志压缩主题
我像这样开始一个控制台制作人
kafka-console-producer.sh --broker-list localhost:9091 --topic log-compaction-test --property print.key=true --property key.separator=,
它监听新消息。现在如果我输入 123,abc ,它会立即抛出错误。
>[2019-09-01 22:12:55,897] WARN [Producer clientId=console-producer] Got error produce response with correlation id 5 on topic-partition log-compaction-test-0, retrying (2 attempts left). Error: CORRUPT_MESSAGE (org.apache.kafka.clients.producer.internals.Sender)
[2019-09-01 22:12:56,030] WARN [Producer clientId=console-producer] Got error produce response with correlation id 6 on topic-partition log-compaction-test-0, retrying (1 attempts left). Error: CORRUPT_MESSAGE (org.apache.kafka.clients.producer.internals.Sender)
[2019-09-01 22:12:56,134] WARN [Producer clientId=console-producer] Got error produce response with correlation id 7 on topic-partition log-compaction-test-0, retrying (0 attempts left). Error: CORRUPT_MESSAGE (org.apache.kafka.clients.producer.internals.Sender)
[2019-09-01 22:12:56,243] ERROR Error when sending message to topic log-compaction-test with key: null, value: 8 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-console-producer.sh --broker-list 0.0.0.0:9091 --topic log-compaction-test --property print.key=true --property key.separator=,
我做错了什么?我确实发送了密钥。不知何故,kafka 认为它是空键。
我为 zookeeper 和 kafka 代理使用 docker 容器。
【问题讨论】:
标签: apache-kafka