Technology Sharing

[Kafka] Kafka producer reports an error after enabling idempotence: Cluster authorization failed.

2024-07-11

한어Русский языкEnglishFrançaisIndonesianSanskrit日本語DeutschPortuguêsΕλληνικάespañolItalianoSuomalainenLatina

background

  1. To meet user business needs, the producer's idempotence needs to be enabled. The producer adds the configuration: enable.idempotence = true
  2. The cluster used by the user has ACL authentication enabled: SASL_PLAINTEXT/SCRAM-SHA-512
  3. When a user produces a message, an error message is displayed: org.apache.kafka.common.errors.ClusterAuthorizationException: Cluster authorization failed.

solve

Server Configuration

Looking at the Kafka source code, I found that the producer configuration (enable.idempotence) has a description:

When set to 'true', the producer will ensure that exactly one copy of each message is written in the stream. If 'false', producer retries due to broker failures, etc., may write duplicates of the retried message in the stream. Note that enabling idempotence requires