Is Kafka replication a backup?

Replication keeps a cluster available when a broker fails. It does not bring back data that was deleted, overwritten or encrypted. Here is where the two differ, and what a Kafka backup has to provide.

What replication protects against

Kafka writes every partition to several brokers. When a broker or an availability zone fails, another replica takes over, and producers and consumers carry on. That is availability: the same data on more than one machine.

What replication copies along with the data

Replicas follow the leader. Whatever happens to a partition happens on every replica:

  • A topic is deleted, by a pipeline run or by hand. Every replica deletes it.
  • A retention or compaction setting is changed by mistake. Every replica drops the records.
  • A faulty release writes wrong records. They are replicated like any others.
  • An attacker with administrator rights deletes topics or the whole cluster. Ransomware works this way.

None of these is a hardware failure, and replication holds no earlier state to return to.

MirrorMaker and Cluster Linking are replication too

A second cluster in another region, kept in sync by MirrorMaker 2 or Cluster Linking, protects against the loss of a region. It is still a mirror. Records written by mistake arrive there seconds later, and depending on the setup, configuration changes follow as well. A mirror also knows only the present: you cannot ask it for the state of yesterday at 14:00.

Tiered storage is not a backup either

Tiered storage moves older segments to object storage to relieve the broker disks. The data still belongs to the topic. When the topic is deleted or its retention expires, the segments in object storage go with it.

What a Kafka backup has to provide

  • A point in time. You return to the state before the mistake, not to the latest state.
  • Separation. The backup lies outside the cluster, with access rights of its own.
  • Everything your consumers need. Records, the schemas with their IDs and the offsets of the consumer groups.
  • A tested restore. Rehearsed in an isolated cluster and documented. Regulations such as DORA ask for this evidence.

Replication and backup together

You need both. Replication, and a mirror cluster where required, carries you through the failure of a broker, a zone or a region. A backup brings you back after deletions, faulty data and attacks.

streamkeepr is the backup: it continuously backs up topics, schemas and consumer offsets to your own S3 bucket and restores a whole cluster or a single topic to a point in time. See how a restore works and where your data stays.

See it on a cluster like yours

We show a backup, a point-in-time restore with consumer groups and a production data clone on a test cluster, and answer your recovery questions.