相关文章推荐
Collectives™ on Stack Overflow

Find centralized, trusted content and collaborate around the technologies you use most.

Learn more about Collectives

Teams

Q&A for work

Connect and share knowledge within a single location that is structured and easy to search.

Learn more about Teams

I start a console producer like this

kafka-console-producer.sh --broker-list localhost:9091 --topic log-compaction-test --property print.key=true --property key.separator=,

It listens for new messages. Now if i type 123,abc , it immediately throws below error.

>[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.

I also tried this way. no luck.

kafka-console-producer.sh --broker-list 0.0.0.0:9091 --topic log-compaction-test --property print.key=true --property key.separator=,

What am I doing wrong? I do send the key. Somehow kafka thinks it is null key.

I use docker containers for zookeeper and kafka brokers.

Thanks for contributing an answer to Stack Overflow!

  • Please be sure to answer the question. Provide details and share your research!

But avoid

  • Asking for help, clarification, or responding to other answers.
  • Making statements based on opinion; back them up with references or personal experience.

To learn more, see our tips on writing great answers.

 
推荐文章