Skip to main content

Kafka Backup Verification: Prove Your Backups Work

· 11 min read
OSO Engineering
The team behind OSO Kafka Backup

Kafka backup verification requires more than a successful backup job. Inspect the manifest, run quick and deep validation, validate the restore plan, restore into isolation, and test the recovered workload.

Each step finds a different failure class. Only the complete sequence tests stored data, Kafka access, consumer positions, schemas, and application assumptions together.

Key takeaway

A valid backup has readable segments and a tested recovery path. Treat an isolated restore drill as required recovery evidence, not an optional exercise.

Build a Kafka backup verification ladder

A green scheduler status proves that a process exited successfully. It does not prove that the selected topics were correct or that every stored segment is readable.

Verification works best as a ladder. Each level adds evidence while exposing a new dependency.

Verification levelWhat it provesWhat remains untested
Job completionThe backup process reported successScope, stored integrity, and recovery
Manifest inspectionExpected topics, partitions, and time bounds were recordedSegment readability and restore behavior
Quick validationMetadata and the expected segment inventory existFull segment contents and target Kafka
Deep validationStored segments can be read and verifiedTarget access, capacity, and applications
Restore-plan validationThe configuration and target connection are usableActual writes and post-restore behavior
Isolated restoreKafka can accept the selected recovery pointConsumer and business behavior
Application testA controlled workload can read and process restored recordsUnexercised scale and failure cases

Run quick validation after each completed backup. Run deep validation on a schedule that matches the data's risk. Restore drills should recur often enough to catch configuration drift before an incident.

Replication does not replace these checks. A replica can receive the same bad write or deletion as the source. The Kafka backup best practices guide explains how backup and replication serve different recovery needs.

Define recovery acceptance criteria before testing

Write down what must recover before running any command. Otherwise, a test can finish successfully while missing a critical topic or consumer group.

Start with this inventory:

  • Required topics and their partition counts
  • Expected record and timestamp bounds
  • Consumer groups that must resume
  • Key, header, and timestamp requirements
  • Schema subjects or serializers used by applications
  • Topic mappings and intentional exclusions
  • Downstream systems that must stay disabled during testing

Tie every check to the intended recovery point. A point-in-time restore should not match the full backup's final record count. A remapped topic will not keep the original topic name.

Set explicit pass conditions. For example, require all selected partitions, zero damaged segments, valid schemas, and a controlled consumer run without offset-range errors.

Record the person who owns a failed test. Include a remediation deadline and the conditions for the retest. A failed drill is a recovery issue, even when production remains healthy.

Inspect the manifest and run Kafka backup verification

First confirm that the intended backup ID exists. Then inspect its recorded scope.

kafka-backup list \
--path s3://company-kafka-backups/production/orders-cluster

kafka-backup describe \
--path s3://company-kafka-backups/production/orders-cluster \
--backup-id production-orders-daily \
--format json

Review the source cluster, topic set, partitions, segments, record totals, and time range. Compare them with the acceptance criteria. Investigate an omission before moving to integrity checks.

Run quick validation after the backup completes:

kafka-backup validate \
--path s3://company-kafka-backups/production/orders-cluster \
--backup-id production-orders-daily

This command checks stored metadata and the expected segment inventory. It is a fast way to catch missing backup artifacts.

Deep validation reads and verifies every segment:

kafka-backup validate \
--path s3://company-kafka-backups/production/orders-cluster \
--backup-id production-orders-daily \
--deep

The report lists checked, valid, missing, and damaged segments. It also reports the records validated and a final valid or invalid result.

Deep validation adds storage-read and segment-integrity evidence. It still does not test target Kafka permissions, available capacity, topic creation, or consumer behavior.

The CLI basics guide documents the list, describe, and validate commands.

Validate the restore plan before changing Kafka

Create a reviewed restore configuration for a scratch cluster. A carefully mapped test topic can work for smaller drills, but a separate cluster gives a stronger isolation boundary.

Run the restore configuration validator before writing records:

kafka-backup validate-restore \
--config restore-drill.yaml \
--format json

Review the reported topics, segments, record estimate, byte estimate, time range, and consumer offset actions. Resolve target connection errors and every unexpected warning.

Check topic mappings with special care. A missing mapping can direct test data into an existing topic. Existing target records can also make count comparisons misleading.

Use credentials created for the drill. Keep production consumers, producers, and service accounts away from the target. The validator checks the restore plan, but it cannot prevent an application from calling a real downstream service later.

The backup and restore tutorial shows a current restore configuration and point-in-time options.

Run an isolated restore drill

Provision the target with enough brokers, storage, network access, and Kafka permissions for the chosen scope. Restore a representative recovery point using the reviewed configuration.

kafka-backup restore --config restore-drill.yaml

Record the backup ID, software version, recovery point, start time, finish time, and result. These details make later tests comparable.

A single-topic drill gives frequent feedback at low cost. It does not prove that a full-cluster restore will meet the recovery time target. Run full-scope drills when the recovery plan requires that evidence.

Protect external systems before starting any consumer. Disable webhooks, email, payment calls, and writes to production databases. Network policy can provide a stronger guard than application configuration alone.

Keep the source backup unchanged during the drill. Avoid retention cleanup until testing finishes and the evidence is stored.

Compare the restored cluster with the backup

OSO Kafka Backup can compare a restored cluster with the original manifest. Create a validation configuration after the restore.

validation.yaml
backup_id: "production-orders-daily"

storage:
backend: s3
bucket: company-kafka-backups
region: us-west-2
prefix: production/orders-cluster

target:
bootstrap_servers:
- restored-kafka-0:9092
- restored-kafka-1:9092

checks:
message_count:
enabled: true
mode: exact
fail_threshold: 0
offset_range:
enabled: true
verify_high_watermark: true
verify_low_watermark: true
consumer_group_offsets:
enabled: true
verify_all_groups: false
groups:
- order-processor

evidence:
formats:
- json

triggered_by: "weekly-restore-drill"

Run the restored-cluster checks:

kafka-backup validation run --config validation.yaml

Message-count checks compare each selected partition with the backup manifest. Offset-range checks compare partition watermarks with stored segment ranges. Consumer-group checks confirm that selected group positions are present and valid.

Use exact counts when the restored scope should match the manifest. Use a sample only when the written test policy accepts reduced coverage. Record that choice with the result.

For point-in-time recovery, set the matching pitr_timestamp in the validation configuration. Otherwise, the evidence can describe a different recovery point than the restore.

The backup validation guide covers JSON and PDF evidence reports. The validation configuration reference lists every supported check.

Test consumer and application recovery

Manifest comparisons cannot prove that an application understands the restored records. A controlled consumer test closes that gap.

Restore records before resetting consumer group positions. Original record offsets and committed group positions serve different roles. The consumer offsets recovery runbook explains the required order.

Start one test consumer with outbound effects disabled. Verify these behaviors:

  1. Keys, values, headers, and timestamps deserialize correctly.
  2. The consumer reads from the intended restored position.
  3. No required partition produces an offset-range error.
  4. Duplicate records follow the application's idempotency rules.
  5. Ordering assumptions hold within each partition.
  6. Lag changes as expected while the test consumer runs.

Test any schema dependency from the isolated environment. A valid record segment does not prove that the required schema is available or compatible.

Do not claim exactly-once business effects from a backup validation result. That outcome also depends on transactions, external stores, and application logic outside Kafka.

Automate the verification schedule and evidence

Use several cadences instead of one large annual exercise. Frequent small tests catch drift earlier, while periodic full tests measure the complete recovery path.

ActivityExample cadenceTrigger an extra run after
Quick validationAfter every backupStorage or backup scope changes
Deep validationDaily or weeklyCompression or storage class changes
Single-topic restoreWeeklyKafka, ACL, or schema changes
Full-scope restoreQuarterlyCluster sizing or recovery design changes
Tabletop runbook reviewMonthlyTeam ownership or escalation changes

These are starting points, not universal requirements. Choose intervals from the data's risk, change rate, and written recovery objectives.

Store each result with the backup ID, tested recovery point, tool version, duration, checks, outcome, and remediation. Keep evidence access separate from backup write access when your security policy requires that boundary.

Kubernetes users can schedule checks with the KafkaBackupValidation custom resource. It supports message-count, offset-range, consumer-group, and evidence settings. Keep the resource in version control with the backup configuration.

Troubleshoot a failed verification

Preserve the failed backup, command output, and evidence until the cause is understood. Deleting them can remove the best record of the fault.

SymptomLikely causeSafe next check
Expected topic is absentSelection, ACL, or retention mismatchCompare source scope with the manifest
Deep validation finds damageMissing or unreadable segmentPreserve the backup and inspect storage events
Restore-plan validation warns about existing topicsWrong target or incomplete mappingReview target inventory and topic mappings
Restored counts differWrong recovery point, extra target data, or missing segmentCompare time filters, mappings, and manifest totals
Consumer position is invalidGroup snapshot or offset mapping mismatchStop consumers and inspect restored offset coverage
Records fail to deserializeMissing or incompatible schemaTest the required schema subjects and versions
Restore exceeds its target timeArchive retrieval, capacity, or throughput limitMeasure each restore stage before tuning

Fix the cause, create a new recovery point when needed, and rerun the full ladder. A quick validation pass does not close a failed restore drill.

Never delete the last known good recovery point during remediation. Confirm retention behavior before cleanup resumes.

Control verification cost and blast radius

Deep validation reads every stored segment. Restore drills also consume Kafka capacity, network bandwidth, and storage requests. Include those costs in the backup operating budget.

Run representative small restores frequently. Use full-scale drills to measure recovery time and capacity at the intervals required by the recovery plan.

Archived objects may need retrieval before validation or restore. Test that path directly. A retention policy should include retrieval delay, fees, and the time required to stage data.

Apply least-privilege access to the backup storage and isolated Kafka target. The validation identity needs read access to backup artifacts and only the Kafka permissions required by its checks.

The Kafka disaster recovery guide connects test cadence with recovery time and recovery point planning.

Make recovery proof part of every backup plan

Kafka backup verification starts with the manifest and segment checks. It ends with a restored workload that passes written acceptance criteria.

Begin with one current backup. Run deep validation, restore a noncritical topic into isolation, and test a controlled consumer. Record every result and assign an owner to any failure.

Frequently asked questions

How to backup Kafka?

Copy selected Kafka records and recovery metadata into storage outside the cluster. Then inspect the manifest, run deep integrity validation, and complete an isolated restore drill before treating the backup as recoverable.

How to take backup of Kafka topic?

Select the topic in the backup configuration, choose an independent storage backend, and run the backup command. Confirm every expected partition appears in the manifest, validate all segments, and restore the topic into an isolated target for testing.

How to take Kafka backup?

Create a reviewed backup configuration with the source topics, storage backend, and backup ID, then run kafka-backup backup --config. A completed run still needs manifest inspection, deep validation, and a tested restore path.