apache-kafkakafka-topicstrimzi

How do I configure my topics if want to treat Kafka as a persistent event storage?


We're using Apache Kafka together with Strimzi on Kubernetes. If we want to treat Kafka as a persistent event storage (keeping events indefinitely) how would I have to configure my Topics?

Is my assumption correct, that if we leave the default cleanup.policy (delete) and retention.bytes (-1) and set retention.ms to -1 that the events are never deleted?

apiVersion: kafka.strimzi.io/v1beta2
kind: KafkaTopic
metadata:
  labels:
    strimzi.io/cluster: my-kafka-cluster
  name: my-topic
spec:
  config:
    # cleanup.policy: delete -> default
    # retention.bytes: -1 -> default 
    retention.ms: -1
  partitions: 3
  replicas: 3


Solution

  • That's correct. If you read the Apache documentation on these settings, you can see that retention.bytes and retention.ms are dependent on using the delete cleanup policy. Leaving retention.bytes at the default (meaning there's no size limit just a time limit) means that retention.ms determines the time events are retained, and you have set that time to none.