Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

iTechGuides is reader-supported. When you buy through links on our site, we may earn an affiliate commission. As an Amazon Associate I earn from qualifying purchases. Learn more

The safest way to protect Kafka is to use more than one copy path. Replication inside a cluster keeps broker copies available after a broker failure, but it is not an independent backup. For a recoverable design, replicate to a separate cluster with MirrorMaker 2, export records to an independent system with Kafka Connect, or use both. Preserve topic settings, security, schemas, connector state, and consumer positions along with the records.

This guide explains which method fits each objective, how to build a recovery set, and how to execute a controlled migration without losing records or restarting applications at the wrong offsets.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

What Kafka backup and migration actually protect

A Kafka backup is not just a copy of message bytes. A usable recovery set must let you recreate the topics, authorize clients, restart producers and consumers, and resume processing at an intentional point. That normally means records plus metadata and application dependencies.

  • Records: keys, values, timestamps, headers, and tombstones where the chosen export path preserves them.
  • Topic state: topic names, partition counts, replication factors, retention, cleanup policy, compaction settings, and other topic configurations.
  • Security: principals, ACLs, quotas, listener and authentication settings, and client bootstrap configuration.
  • Processing state: consumer groups and offsets, Kafka Connect connector configurations, connector offsets, and connector status.
  • Contracts and dependencies: schema definitions, serialization settings, transactional requirements, external databases, and sink systems.

Apache Kafka documentation describes replication and export capabilities, but it does not define a universal backup product or guarantee a particular restore result. You must measure recovery-point objective (RPO), recovery-time objective (RTO), throughput, data volume, and acceptable downtime for your own deployment.

Why in-cluster replication is not a backup

Replication factors create multiple broker copies in the same Kafka cluster. That protects availability when a broker or disk fails, but a deleted topic, corrupted data, bad producer, credential mistake, ransomware event, or loss of the whole cluster can affect every replica. An independent target or archive must be in a different failure domain, and preferably a different account, region, or administrative boundary.

Cross-cluster replication and exported records solve different problems:

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
  • Cross-cluster replication maintains a near-live target for disaster recovery, geographic placement, or migration.
  • Exported records provide an independently retained copy that can be inspected or replayed after an accidental deletion or long outage.

Using both gives you a hot recovery target and an archive, but it also creates two operational systems to monitor and test.

Choose the copy method

Method Best use What it copies Main limits
Kafka Connect source and sink Export or import to files, databases, object storage, or another system Records transformed by connector serialization Connector semantics, schemas, offsets, and exactly-once behavior depend on the connector. File examples demonstrate a pipeline, not a complete disaster-recovery system.
Legacy MirrorMaker Basic source-to-target topic replication Records and keys Source and destination offsets differ. Apache Kafka states that legacy mirroring is not a substitute for in-cluster replication or transparent failover.
MirrorMaker 2 Migration, disaster recovery, geo-replication, and hybrid-cloud moves Topics, topic configurations, consumer groups and offsets, ACLs, partitioning, and newly discovered topics and partitions Replication flows, naming, authentication, offset translation, and cutover must be designed and validated.
Managed Kafka replication Moving to a provider-operated Kafka service Provider-specific replication and migration state Pricing, quotas, regional availability, feature compatibility, and partner terms vary and must be checked for the target service.

Use Kafka Connect when the destination is a file or external system, MirrorMaker 2 when you need a Kafka cluster that stays synchronized, and both when an independent archive and a continuously replicated migration target are required.

Set recovery objectives before copying data

Write down an objective for each service rather than choosing a generic cluster-wide number.

Recovery-point objective

RPO is the maximum acceptable amount of data that could be missing. A continuously replicated target may reduce the gap, but replication lag, unavailable links, and uncommitted records still matter. An exported archive may have a larger interval between exports.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Recovery-time objective

RTO is the time allowed to restore service. Include target provisioning, security setup, topic creation, consumer restart, cache rebuilding, and validation—not just the time to copy records.

Retention and rollback window

Specify how long the old cluster and exported data remain available after cutover. Keep the source read-only or otherwise protected for the agreed rollback period so that a migration defect does not remove your recovery option.

Apache Kafka’s documentation does not publish universal RPO, RTO, throughput, downtime, or data-volume figures. Measure those values with a restore drill in your own environment.

Inventory the source cluster

Do this before creating connectors or replication flows. Capture the inventory in a version-controlled document so that a second operator can rebuild the environment.

Free tools Windows power users keep installed

One-click scans. No signup required.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
  • Kafka version, broker versions, and whether the cluster uses KRaft or ZooKeeper.
  • Every topic, partition count, replication factor, leader distribution, retention period, cleanup policy, compaction settings, and maximum message size.
  • Producer and consumer applications, bootstrap servers, security protocols, serializers, deserializers, and client configuration.
  • Consumer groups, their committed positions, lag, assignment behavior, and whether any groups are paused.
  • ACLs, users or service principals, quotas, TLS certificates, SASL settings, and network allowlists.
  • Schema definitions and compatibility rules, including the schema registry used by applications.
  • Kafka Connect workers, connector configurations, internal topic names, external sinks, and any standalone offset files.
  • Throughput, retention volume, largest topics, compacted topics, transactional producers, tombstone usage, and external databases that are part of the application state.

Record the cutover point you will use later: a timestamp, an agreed producer pause, or another observable boundary. Without a defined boundary, it is difficult to distinguish a missing record from a record that was intentionally produced after migration began.

Export and import with Kafka Connect

Kafka Connect provides continuous pipelines between Kafka and external systems. The Apache Kafka quickstart demonstrates a file source connector that reads lines from a file into a topic and a file sink connector that writes topic records to a file. Those examples are useful for understanding the flow, but a file pipeline alone does not preserve every Kafka feature or provide a disaster-recovery policy.

File export for a simple archive

  1. Run Kafka Connect in the mode appropriate for your deployment and install the connector that writes the required record format.
  2. Configure a source or sink for the selected topic, explicitly choosing key and value converters and the desired encoding.
  3. Write to a storage location with independent retention and access controls. Keep the topic name, export time, connector configuration, and converter settings with each export.
  4. Monitor connector task errors, serialization failures, throughput, and the last successfully processed position.
  5. Test importing a sample into a disposable topic before treating the archive as restorable.

A line-oriented file can lose distinctions that matter to applications, such as binary values, headers, timestamps, schema identifiers, tombstones, or transaction boundaries. Select a connector and format that preserve the fields your consumers require.

Import from an archive

  1. Create the destination topic with the intended partition count and configuration.
  2. Install the matching source connector and configure converters and schema handling to match the exported data.
  3. Choose a partitioning strategy. If the importer cannot reproduce the original partition assignment, key-based ordering and per-partition order may change.
  4. Start with a limited range or test topic, compare records and application behavior, then expand the import.
  5. Record the imported range and any rejected records so a retry does not silently create gaps or duplicates.

Distributed versus standalone Connect state

In distributed mode, Kafka Connect stores configuration, offset, and status information in Kafka topics. Back up the worker configuration and those internal topics as part of the recovery plan. In standalone mode, source offsets are stored in a local file; protect and copy that file or the connector may reread records after a restart.

What’s actually slowing this PC down?

Pick the symptom - the matching free tool is one click away.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Exactly-once behavior, schema evolution, offset semantics, and transaction handling depend on the specific connector and destination. Do not assume that moving records also moves the connector’s external side effects or database transaction state.

Replicate clusters with MirrorMaker 2

MirrorMaker 2 is the Kafka-native choice for a continuously replicated target. Apache Kafka documentation describes it as able to replicate topics, topic configurations, consumer groups and their offsets, ACLs, partitioning, and newly discovered topics and partitions from one or more source clusters to one or more target clusters.

What MM2 changes during a move

Replicated records are written to the destination cluster, but client metadata and offsets still require planning. Topic naming conventions can identify the source cluster, and consumer offsets may be translated rather than copied as identical numbers. Validate the resulting group positions on the target instead of assuming a consumer will resume at the same numeric offset.

Replication setup sequence

  1. Define each replication flow, source and target aliases, topic allowlists or denylists, and whether consumer groups and ACLs are included.
  2. Establish network connectivity, TLS or SASL authentication, trust stores, service principals, and permissions on both clusters.
  3. Set the policy for newly created topics and partitions so that future changes are replicated rather than forgotten.
  4. Start replication and watch lag, task errors, missing topics, partition counts, configuration differences, and offset translation.
  5. Run a consumer test on the destination with a non-production group. Confirm that keys, ordering expectations, headers, tombstones, and compacted-topic behavior meet application requirements.

Legacy MirrorMaker copies records and keys but does not make source and destination offsets interchangeable. Apache Kafka explicitly notes that data is read from a source topic and written to a topic with the same name in the destination, while the differing offsets mean legacy mirroring is not a transparent failover mechanism. Prefer MM2 when migration or consumer continuity is a requirement.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Build the complete recovery set

Store the following artifacts together, with access controls and retention separate from the production cluster:

  • Topic inventory and topic-configuration exports.
  • Record archives or an independently operated replication target.
  • Consumer-group inventory and the offset or checkpoint information produced by the selected replication method.
  • ACLs, quotas, principals, certificates, trust stores, and client bootstrap configuration.
  • Schema definitions, compatibility settings, serializer and deserializer versions.
  • Kafka Connect worker settings, connector definitions, distributed internal topics, or standalone offset files.
  • Infrastructure and network definitions needed to provision brokers, listeners, storage, and monitoring.
  • Runbooks for producers, consumers, external databases, sink systems, and cache or search indexes.

Encrypt exports, restrict who can read them, and record when each artifact was generated. A record archive that cannot be decoded because its converter or schema is missing is not a usable backup.

Migration runbook: from inventory to cutover

1. Define the migration boundary

List the applications and topics in scope, the RPO and RTO for each, the planned downtime, and the rollback window. Decide whether producers will be paused, drained, or coordinated through an application-level switch.

2. Provision the target

Build compatible Kafka protocol, serialization, security, and networking settings. Create principals and permissions. Pre-create topics when exact partition counts, replication factors, retention, or compaction behavior matter; do not rely on defaults that differ between clusters.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

3. Start the copy path

Deploy MM2 flows for a live Kafka target, Connect connectors for external export or import, or both. Confirm that every intended topic appears and that new topics and partitions follow policy.

4. Monitor replication and connectors

Track replication lag, connector task failures, serialization errors, throughput, missing partitions, ACL propagation, and consumer-offset translation. Alert on a stalled flow, not only on a completely stopped process.

5. Validate before switching clients

Compare topic inventories, configurations, partition counts, and replication factors. Where practical, compare record counts, checksums, timestamps, keys, headers, and tombstones over a defined range. Test compacted topics and transactional workloads separately. Start consumers on the target with a test group and verify expected restart positions.

6. Quiesce and drain

Coordinate producers so that writes stop at the agreed boundary. Allow replication to drain, record the final source position or timestamp, and check that the target has received data through that point. Do not declare success based only on low lag; verify the boundary itself.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

7. Switch clients

Update bootstrap servers, schema-registry references, credentials, ACL-dependent settings, and any connector or sink endpoints. Resume producers, then consumers, while watching for authentication failures, duplicate processing, gaps, and unexpected replays.

8. Keep rollback available

Leave the source available or read-only for the agreed window. If the target shows data loss, incompatible schemas, or application defects, stop new writes according to the rollback plan and return clients to the source without allowing both clusters to accept uncontrolled writes.

9. Decommission only after evidence

Retain the source and archives until post-cutover monitoring and a restore test meet the objectives. Remove replication and old infrastructure only after owners approve the evidence.

Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

Validation checks that catch real migration failures

  • Inventory parity: every required topic exists, including low-volume and newly created topics.
  • Partition parity: partition counts and key-based routing support the same ordering assumptions.
  • Configuration parity: retention, compaction, cleanup policy, message-size limits, and replication settings are intentional.
  • Record integrity: compare counts or checksums for a defined interval and inspect keys, timestamps, headers, null values, and tombstones.
  • Consumer behavior: restart a test group and confirm that the translated position is neither an unintended replay nor a gap.
  • Security: authenticate each producer, consumer, connector, and administrative client; verify ACLs and quotas.
  • Application state: reconcile databases, search indexes, caches, and other systems that Kafka records update.
  • Operational readiness: dashboards, alerts, backups, certificates, on-call ownership, and rollback instructions work on the target.

Common failure modes and recovery actions

The target has records but consumers replay too much

Source and destination offsets are not necessarily equal. Inspect MM2’s offset translation and the consumer-group mapping, then choose an intentional restart position. Do not edit offsets blindly while producers are still writing.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Topics exist with the wrong partition count

Stop the migration before cutover, create the target topic correctly, and replicate or import again. Increasing partitions can change key routing and ordering; it is not a neutral repair.

Messages fail serialization

Match key and value converters, schema definitions, compatibility rules, and connector versions. Capture rejected records and reprocess them after correcting the format rather than skipping errors.

Compacted topics behave differently

Preserve cleanup policy and tombstones, and validate the rebuilt state rather than comparing only raw record counts. A compacted topic’s current contents may not represent every historical record.

External side effects are duplicated

Kafka record replication does not automatically make database writes or API calls idempotent. Reconcile external systems, use application-level idempotency where available, and include those systems in the rollback design.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Connect resumes from an unexpected position

Check whether the connector is distributed or standalone. Distributed workers require their internal configuration, offset, and status topics; standalone workers require the local offset file. Restore the corresponding state before restarting tasks.

Managed Kafka migration considerations

A provider-operated Kafka service can simplify broker provisioning, but it does not remove migration design work. Follow the provider’s documented workflow for creating the target, Connect resources, and MM2 resources, then verify feature compatibility with the source.

  • Confirm supported Kafka versions, KRaft or ZooKeeper requirements, authentication mechanisms, quotas, and maximum message sizes.
  • Check regional placement, network connectivity, private endpoints, egress charges, retention limits, and replication quotas.
  • Verify how the service handles ACLs, schemas, consumer offsets, connector internal topics, and newly discovered partitions.
  • Obtain current pricing and regional availability directly from the provider before committing to a design.

Managed replication is still a controlled replication and cutover project: document the source, create the target, replicate, validate, switch clients, monitor, and retain rollback capacity.

Restore-drill checklist

  1. Choose a non-production target or an isolated recovery window.
  2. Provision brokers, networking, security principals, schemas, and topic configurations from the stored artifacts.
  3. Restore records through the same Connect or MM2 path used in the production plan.
  4. Restore consumer and connector state, then start representative producers and consumers.
  5. Verify record integrity, offsets, ACLs, compaction, transactions, external sinks, and application health.
  6. Measure elapsed time, missing data, duplicates, operator actions, and every manual dependency.
  7. Update the runbook and repeat until the measured result meets the service’s RPO and RTO.

A backup is credible only after this exercise demonstrates that records, metadata, security, and applications can resume—not merely that files or replicated topics exist.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Key takeaways

  • Keep at least one copy outside the source cluster’s failure domain.
  • Use Kafka Connect for controlled export and import, MirrorMaker 2 for a live Kafka target, and both when you need hot recovery plus an independent archive.
  • Back up topic settings, ACLs, quotas, schemas, consumer positions, and Connect state with the records.
  • Treat offsets as a migration concern: legacy mirroring does not provide transparent failover, and MM2 requires validation of translated positions.
  • Make cutover a staged project with inventory, replication, validation, a defined boundary, rollback, and a measured restore drill.

Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.