Choosing a Deployment for Your Migration

This content was generated with the assistance of AI and should be verified against the official documentation before being relied on in production.

The pages of this section explain each Debezium building block in depth. This page puts them together as decisions. A migration has to answer five questions before the first connector is registered:

  1. Which runtime hosts the connectors: Kafka Connect, Debezium Server or the Debezium Engine?

  2. How do changes reach the new database: a sink connector that copies rows, or application code that translates them?

  3. Which snapshot strategy loads the existing data, given its size and what the legacy database allows?

  4. Is the synchronisation one-way or two-way, and for how long?

  5. Where does it all run: on a laptop, on Kubernetes, or on managed cloud services?

Each answer depends partly on the previous ones, so the flowchart below walks through them in order. The tables after it give the criteria for each choice and link every row to the page that covers it. The Bookshop migration (legacy Oracle schema BOOKSHOP to the Spring Boot bookshop application on PostgreSQL 18) is used as the running example, and the last sections show how the same questions lead to different answers for smaller migrations.

Checked on 2026-11-09 against Debezium 3.7.1.Final. This page contains no runnable configuration; it summarises the pages it links, which state what was run on each of them.

The decision flow

flowchart TD A["Start: a legacy database to migrate"] --> B{"Do several consumers need the events, or must they be replayable?"} B -- "Yes" --> KC["Runtime: Kafka Connect + Kafka"] B -- "No" --> C{"Is the destination a non-Kafka broker or a single sink?"} C -- "Yes" --> DS["Runtime: Debezium Server"] C -- "No, the logic lives in one Java service" --> EN["Runtime: Debezium Engine"] KC --> D{"Does the new database keep the legacy model?"} DS --> D EN --> D D -- "Same tables and columns" --> SINK["Apply with the JDBC or MongoDB sink"] D -- "New model" --> ACL["Mirror with a sink and translate in an application consumer"] SINK --> E{"Can the full data set be read within the log retention window?"} ACL --> E E -- "Yes" --> INIT["snapshot.mode=initial"] E -- "No, or the snapshot must be resumable" --> INC["snapshot.mode=no_data + incremental snapshots"] INIT --> F{"Must the legacy system keep receiving changes after the write cut-over?"} INC --> F F -- "No" --> ONE["One-way sync, then decommission"] F -- "Yes, as a rollback path" --> TWO["Two-way sync: reverse replication with loop prevention"]

The diagram is a simplification. A migration can combine runtimes (Kafka Connect for the main pipeline and an Engine inside a test harness), apply some tables with a sink and others with code, and use different snapshot strategies per table. The tables below explain the criteria behind each branch.

Decision 1: the runtime

All three runtimes run the same source connectors and produce the same change events. They differ in how many consumers can read the events, where offsets and the schema history live, and how failures are handled.

If the migration…​ Choose Because Details

Runs for weeks or months, has several consumers (a mirror sink, an anti-corruption layer, reconciliation jobs, reverse replication) or needs to replay history

Kafka Connect with Kafka

Each consumer has its own position on durable topics; offsets and schema history are replicated in Kafka; workers rebalance tasks after a failure; exactly-once source delivery is available

Debezium Architecture, Installing Debezium

Moves data point to point into one target, or the organisation runs Kinesis, Pub/Sub, Event Hubs, Pulsar, NATS, RabbitMQ Streams or Redis instead of Kafka

Debezium Server

One process per source connector with a sink for that system, including a JDBC sink that writes straight into the new database; no Kafka cluster to run

Debezium Server

Is a tool or a service whose migration logic already lives in one Java application, or is an integration test

Debezium Engine

The connector runs in-process and calls your code for each batch; you own offsets, schema history and failure handling

Debezium Engine (Embedded)

Must run on Kubernetes

Kafka Connect with Strimzi, or Debezium Server with the Debezium Operator

Both are declarative custom resources; the Debezium Management Platform adds a console and API for Debezium Server pipelines

Running on Kubernetes

Must run on managed cloud services

MSK Connect, Confluent Cloud (custom or fully managed connectors), self-managed Connect on EKS, GKE or AKS, or Debezium Server with a cloud sink

The cloud database’s log settings and the managed runtime’s limits (plug-in packaging, capacity mode, Kafka Connect version) decide what is possible

Cloud Databases & Managed Kafka

Two follow-up questions refine the choice:

  • Do you need exactly-once delivery from the source? Only Kafka Connect provides it (KIP-618, for the connectors that support it), and it is a worker setting. With Debezium Server or the Engine, design the consumers to be idempotent instead. See Offsets, Restarts & Exactly-Once.

  • Who operates it? Kafka Connect plus Kafka is the most capable option and the most infrastructure. If the team does not already run Kafka, the cost of learning and operating it is part of the migration’s cost. That is the strongest argument for Debezium Server in a small migration.

Decision 2: how changes reach the new database

A copy is not a migration. The question here is whether the new database has the same model as the legacy one.

If the new database…​ Apply changes with Because Details

Has the same tables and columns (a re-platforming: same schema, new engine or new host)

The Debezium JDBC sink connector, insert.mode=upsert, primary.key.mode=record_key, delete.enabled=true

It consumes native Debezium envelopes, writes idempotently by primary key, applies deletes and can evolve the target schema

JDBC Sink Connector

Is a document database (MongoDB) holding one document per legacy row

The Debezium MongoDB sink connector

It upserts and deletes documents by the event key

MongoDB Sink Connector

Has a new model (renamed columns, codes turned into enums, one table split into several, surrogate keys, uuid ids)

An application consumer that acts as the anti-corruption layer (in Bookshop, LegacyBookTranslator, LegacyCustomerTranslator and LegacyOrderProjector in consumer group bookshop-legacy-sync)

Translation rules are business logic: they need tests, versioning and the new domain model, which SMTs cannot hold

Listening to Events in Applications, Migration Patterns with CDC

Has a new model, and the translation needs data from several legacy tables that change independently

A mirror first (JDBC sink into legacy_* staging tables), then the application consumer reads the mirror and the events

The mirror gives the consumer a consistent, queryable copy of the related legacy rows, so it does not have to keep its own state for joins

JDBC Sink Connector, Worked Example: Oracle to PostgreSQL

Needs only small, per-record changes (rename a topic or a field, drop a column, convert a time zone, flatten the envelope)

Single message transformations on the sink or source connector

Stateless per-record changes fit SMTs well; anything that needs state or several tables does not

Debezium Transformations, Event Flattening

Should receive domain events rather than table rows (the new system is a set of services)

An outbox table in the legacy application plus the Outbox Event Router

Services consume intent-level events instead of the legacy schema, so they never couple to it

Outbox Event Router

Bookshop combines a sink and an application consumer on the same topics, in different consumer groups. The JDBC sink bookshop-pg-mirror-sink keeps legacy_book, legacy_author and legacy_supplier_catalogue as 1:1 mirrors, which the reconciliation compares with the new model, and the Spring Boot consumers translate the legacy events into book, book_author, customer, purchase_order and order_line. The consumers read the events only, not the mirror tables.

Decision 3: the snapshot strategy

The snapshot loads the rows that exist before streaming starts. The right strategy depends on how long a full read takes compared with how long the legacy database keeps its change log, on whether the read must be resumable, and on what the connector may do in the legacy database.

Situation Strategy Why Details

The full data set can be read well within the log retention window, and a restart from zero is acceptable

snapshot.mode=initial

The simplest option: one consistent snapshot, then streaming from that position

Initial Snapshots

A table is so large that the snapshot could outlast the log retention, or restarting a failed multi-day snapshot from zero is unacceptable

snapshot.mode=no_data, then incremental snapshots table by table

Streaming starts at once, so retention is no longer a race; incremental snapshots read in chunks, interleave with streaming and resume after a restart

Initial Snapshots — Sizing a multi-terabyte snapshot, Incremental & Blocking Snapshots

Only part of a large table is needed now (for example the last two years of ORDERS)

Incremental snapshot with additional-conditions

Loads a filtered range; the rest can follow later or never

Incremental & Blocking Snapshots — Partial backfills

A table joins the migration scope while the connector is running

Add it to table.include.list and send an execute-snapshot signal for it

The new table is backfilled without re-reading the others

Incremental & Blocking Snapshots — Adding a table

The connector may not write to the legacy database (no signal table allowed)

A read-only incremental snapshot (PostgreSQL 13 or later, MySQL and MariaDB with GTIDs), triggered through the Kafka signal channel

Watermarks come from the database’s own transaction state instead of signal table writes; the Oracle connector has no read-only variant, so it needs the signal table

Incremental & Blocking Snapshots — Read-only incremental snapshots, Signaling & Notifications

A table has no primary key

An incremental snapshot with a surrogate-key, or a blocking snapshot

Incremental chunks are ordered by a key; without one, a full read is the only option

Incremental & Blocking Snapshots — Composite keys and the surrogate-key option

A large table must be loaded quickly in a quiet window, and a pause in streaming is acceptable

A blocking snapshot (execute-snapshot with "type": "blocking")

Faster than incremental, but streaming stops until it finishes and it is not resumable

Incremental & Blocking Snapshots — Blocking snapshots

The data was already loaded by another tool (a dump, a bulk load), or the connector is the reverse-replication source on the new database

snapshot.mode=no_data

Only changes from now on are needed; snapshotting reverse data would write every row back to the legacy database

Initial Snapshots, Cut-over & Reverse Replication

A rehearsal against a production clone, to measure how long the snapshot takes

snapshot.mode=initial_only

Snapshots and stops, so the duration and the Kafka volume can be measured before the real run

Initial Snapshots

The connector may be stopped for longer than the log retention, and consumers can absorb a full re-read

snapshot.mode=when_needed

Re-snapshots automatically when the stored position is gone instead of failing. It also hides the incident, so for a migration source such as bookshop-oracle-source keep initial and recover deliberately, followed by a reconciliation

Initial Snapshots, Troubleshooting & Failure Recovery

The schema history topic was lost or damaged

snapshot.mode=recovery (connectors with a schema history)

Rebuilds the history from the current table structures; safe only if no DDL ran since the connector stopped

Handling Schema Changes, Troubleshooting & Failure Recovery

Size is relative. A table is "large" when the time to read it, including the time Kafka and the sinks need to absorb the burst, approaches the log retention you can afford on the legacy database. Measure it with an initial_only rehearsal instead of guessing from row counts. The database-specific retention settings are on the connector pages and, for managed databases, on Cloud Databases & Managed Kafka.

Decision 4: one-way or two-way synchronisation

Every CDC migration starts one-way: the legacy database is the source of truth and the new database follows. The question is what happens when writes move to the new system.

Phase and requirement Direction What runs Details

Initial load, parallel run and read cut-over; the legacy system is the only writer

One-way, legacy to new

The source connector (bookshop-oracle-source), the mirror sink and the anti-corruption layer

Migration Patterns with CDC

Write cut-over with no need to fall back: legacy consumers (reports, batch jobs) can be switched off or moved at the same moment

One-way, then stop

The forward pipeline is drained and stopped; the legacy database becomes read-only

Cut-over & Reverse Replication

Write cut-over where the legacy system must stay correct for a while: as a rollback path, or because legacy reports and batch jobs still read it

Two-way, with each table owned by one side at a time

A reverse source on the new database (bookshop-pg-source, slot bookshop_reverse, publication bookshop_reverse_pub) and a sink back to Oracle (bookshop-oracle-reverse-sink, writing as BOOKSHOP_SYNC)

Cut-over & Reverse Replication

Two-way sync is running

Loop prevention is mandatory

Each source connector skips the other direction’s writes. On Oracle, the forward connector sets log.mining.username.exclude.list to BOOKSHOP_SYNC. On PostgreSQL, the forward translators tag their sessions with a replication origin and the reverse connector uses slot.stream.params=origin=none; an origin marker column such as changed_by, dropped with the Filter SMT, is the fallback or second line of defence

Oracle Connector — Filtering by user, Cut-over & Reverse Replication — Replication origins, Migration Patterns with CDC — Loops and ownership

Both systems need to accept writes to the same rows at the same time

Avoid

CDC gives no conflict resolution; concurrent writes to one row on both sides lose updates. Split ownership by table, by entity or by customer cohort instead

Migration Path — Feature flags and cohort-based cut-over

Two-way synchronisation doubles the moving parts and must have an end date. Decide before the cut-over what condition switches the reverse pipeline off; the decommission phase is described in Migration Patterns with CDC.

Decision 5: where it runs

Environment Typical shape Details

Laptop, tutorial or proof of concept

Docker Compose with quay.io/debezium/kafka:3.7.1.Final, quay.io/debezium/connect:3.7.1.Final and the databases

Getting Started: First Change Events

Integration tests in CI

Testcontainers with the same images, or an embedded Debezium Engine

Testing CDC Pipelines

Virtual machines or bare metal

A Kafka Connect cluster with plug-in archives in plugin.path, or a custom Connect image

Installing Debezium

Kubernetes

Strimzi KafkaConnect and KafkaConnector resources, or the Debezium Operator for Debezium Server

Running on Kubernetes

Managed cloud databases and managed Kafka

RDS, Aurora, Cloud SQL, Azure Database or Azure SQL as source or target; MSK Connect, Confluent Cloud or Connect on EKS, GKE or AKS as the runtime

Cloud Databases & Managed Kafka

Wherever it runs, a production migration also needs monitoring, secret handling and a recovery runbook before go-live: Monitoring, Logging & Tracing, Security & Data Protection and Troubleshooting & Failure Recovery.

The Bookshop choices

Decision Bookshop choice Reason

Runtime

Kafka Connect with Kafka 4.x (KRaft), Connect REST at http://localhost:8083

Several consumers (mirror sink, bookshop-legacy-sync, reconciliation, reverse replication) and a long overlap

Wire format

JSON with schemas enabled, decimal.handling.mode=string and provide.transaction.metadata=true on bookshop-oracle-source; no Avro

The JDBC mirror sink needs the embedded schema, and every consumer of a topic must read the same format (see Best Practices)

Applying changes

bookshop-pg-mirror-sink for the legacy_* mirror tables; the Spring Boot anti-corruption layer for the new model

The new model differs from the legacy one (uuid keys, book_author, status codes as text)

Snapshot

initial for the legacy tables; incremental snapshots for tables added later and for re-loads

The schema is small enough to snapshot within the archive log retention; incremental snapshots cover changes of scope

Direction

One-way during load, parallel run and read cut-over; two-way during the write cut-over, with BOOKSHOP_SYNC excluded on the Oracle source

Legacy reports keep reading Oracle until they are retired, and the rollback path must stay open

Hosting

Docker Compose for the worked example; Strimzi on Kubernetes for production

The same connector JSON runs in both

Three smaller profiles

The same questions lead to simpler answers when the migration is simpler.

A same-schema move of a small MySQL database to PostgreSQL, one team, no Kafka. Several consumers? No. Destination? One database. Debezium Server with its JDBC sink copies the tables directly, initial snapshot, one-way, then decommission. The JDBC sink’s type mapping still has to be checked (see Data Types & Precision).

A legacy PostgreSQL database feeding a new service that owns its own model, inside one Java application. The service can embed the Debezium Engine, translate events in-process and store offsets in its own database. This works while there is one consumer; the moment a second system needs the same events, move to Kafka Connect so that the events are on durable topics.

A large SQL Server database on Azure SQL, migrating to Azure Database for PostgreSQL, with an existing Kafka platform. Kafka Connect on AKS, no_data plus incremental snapshots for the largest tables because the CDC change table retention bounds how long a full read may take, the JDBC sink for same-shape tables and a consumer for the rest, and the platform-specific settings from Cloud Databases & Managed Kafka.

Choices that cause trouble later

Choice Why it causes trouble

Debezium Engine for a migration that later gains a second consumer

Events are not on a durable, shared log; the second consumer needs a second capture (another slot or LogMiner session on the legacy database) or a re-architecture

Doing the model translation in SMTs

Stateless per-record transforms cannot join tables, look up reference data or keep versioned business rules; the logic ends up untested in connector JSON

initial snapshot of a multi-terabyte table with short log retention

A snapshot that outlasts the retention cannot switch to streaming, and a failure restarts it from zero

Two-way sync without loop prevention or ownership rules

Changes echo between the databases, and concurrent writes to the same rows are lost

Choosing a managed runtime before checking its limits

Single-task connectors with autoscaling, missing JDBC drivers in uploaded plug-ins, or a Kafka Connect version that does not match the connector can block the migration late

No decision on when two-way sync ends

The reverse pipeline becomes permanent infrastructure with all the cost of the migration and none of the benefit

The checklist on Best Practices turns these decisions into items to verify before go-live.