Skip to contentManaged Kafka is live: Apache Kafka on AWS for half the cost of MSK

Using Artie

Migrate a pipeline online with a shared source reader

Run a new pipeline next to an existing one on the same source reader, then cut over once it has caught up.

A shared source reader captures changes from your source once and publishes them to Kafka. Each pipeline attached to the reader consumes that stream separately.

Sharing a source reader is configured only through Terraform, not the dashboard. The examples on this page use the artie Terraform provider.

Use an online migration to:

  • Move a pipeline to a different destination database without a second change data capture (CDC) reader on your source.
  • Re-create a pipeline with different settings, such as a new destination schema, history mode or partitioning, and cut over once it has caught up.
  • Validate a new destination in parallel before you retire the old one.

Shared reader topology

Before the migration, one pipeline has a dedicated source reader:

KafkaMySQLSource ReaderOld Pipeline → SnowflakeANALYTICS_V1

During the migration, you promote that source reader to shared and attach a second pipeline to it. The reader publishes to Kafka once, and both pipelines consume from it independently:

KafkaKafkaMySQLShared Source ReaderOld Pipeline → SnowflakeANALYTICS_V1New Pipeline → SnowflakeANALYTICS_V2

After the new pipeline has backfilled and caught up to the source, you delete the old pipeline:

KafkaMySQLShared Source ReaderNew Pipeline → SnowflakeANALYTICS_V2

Each pipeline has its own Kafka consumer group, so offsets are tracked per pipeline. The old pipeline keeps its position in the stream while the new pipeline backfills and catches up at its own pace.

Change capture stays on the one reader. The new pipeline adds no replication slot or binlog reader on your source. Its backfill does read the pipeline’s tables from your source database.

Prerequisites

  • The existing pipeline and its source reader are managed in Terraform, or imported into Terraform state.
  • The destination connector for the new pipeline exists as an artie_connector resource.
  • You have a list of every table that either pipeline replicates. A shared source reader captures only the tables in its tables block.
  • The existing pipeline’s destination isn’t Kafka, and its source isn’t S3. Neither works with a shared source reader.

To import existing resources, see terraform import for the source reader and the pipeline. To find their UUIDs, open the pipeline in the dashboard, open More options, and select View UUIDs.

Steps

  1. Promote the existing source reader to shared

    Set is_shared = true on the source reader and add a tables block that lists every table the reader captures. The provider rejects a shared reader that has no tables block.

    This example shares a MySQL source reader that captures two tables:

    terraform
    resource "artie_source_reader" "mysql_reader" {
      name           = "MySQL Production Reader"
      connector_uuid = artie_connector.mysql_prod.uuid
      database_name  = "app"
    
      is_shared = true # ← promote to shared
    
      # Required once shared: list every table the reader should capture.
      tables = {
        "app.orders" = {
          name   = "orders"
          schema = "app"
        }
        "app.customers" = {
          name   = "customers"
          schema = "app"
        }
      }
    }

    Each key is schema_name.table_name. If a table sets columns_to_include or columns_to_exclude, that list applies to every pipeline on the reader.

    Run terraform plan and confirm that the source reader is the only resource that changes. Then run terraform apply. Terraform updates the reader and deploys it as a shared source reader.

  2. Create the new pipeline against the same source reader

    Add a second artie_pipeline resource with the same source_reader_uuid as your existing pipeline and a different destination database. This example writes the new pipeline to the Snowflake database ANALYTICS_V2:

    terraform
    # Existing pipeline (unchanged) → Snowflake database "ANALYTICS_V1"
    resource "artie_pipeline" "mysql_to_snowflake_v1" {
      name               = "MySQL to Snowflake (v1)"
      source_reader_uuid = artie_source_reader.mysql_reader.uuid
    
      destination_connector_uuid = artie_connector.snowflake.uuid
      destination_config = {
        database = "ANALYTICS_V1"
        schema   = "PUBLIC"
      }
    
      tables = {
        "app.orders"    = { name = "orders", schema = "app" }
        "app.customers" = { name = "customers", schema = "app" }
      }
    }
    
    # New pipeline → Snowflake database "ANALYTICS_V2", same source reader
    resource "artie_pipeline" "mysql_to_snowflake_v2" {
      name               = "MySQL to Snowflake (v2)"
      source_reader_uuid = artie_source_reader.mysql_reader.uuid # ← shared reader
    
      destination_connector_uuid = artie_connector.snowflake.uuid
      destination_config = {
        database = "ANALYTICS_V2" # ← different database
        schema   = "PUBLIC"
      }
    
      tables = {
        "app.orders"    = { name = "orders", schema = "app" }
        "app.customers" = { name = "customers", schema = "app" }
      }
    }

    Run terraform apply. Terraform creates and starts the new pipeline. Artie backfills its tables into ANALYTICS_V2, then applies the live changes from the shared reader’s Kafka stream.

    Every table in the new pipeline must also be in the reader’s tables block. If one is missing, Artie rejects the pipeline with this error:

    Text
    shared source reader does not have a table config for table "app.orders"
  3. Let the new pipeline backfill and catch up

    One source reader now feeds two pipelines. The old pipeline writes to ANALYTICS_V1 and the new pipeline writes to ANALYTICS_V2.

    Watch the new pipeline in the analytics portal until its backfill completes and its lag drops to near zero. The new pipeline has then caught up to the live change stream and is in sync with the old pipeline.

    Validate the data in ANALYTICS_V2 with row counts, spot checks and your downstream queries before you cut over.

  4. Cut over and delete the old pipeline

    Cut over after you confirm that the new pipeline has caught up and the data in ANALYTICS_V2 is correct:

    1. Point your downstream consumers at the new database.
    2. Remove the old pipeline’s resource block from your Terraform configuration.
    3. Run terraform apply.

    Terraform deletes the old pipeline. The shared source reader keeps running and feeds only the new pipeline.

  5. (Optional) Convert the reader back to UI-managed

    While a reader is shared, its source settings are read-only in the dashboard. Under Advanced settings on the pipeline’s Source tab, the dashboard shows this banner:

    Text
    Other pipelines share this source's settings, so change them in Terraform.

    To edit the reader from the dashboard again, set is_shared = false and remove the tables block. The provider rejects a tables block on a reader that isn’t shared, because that reader captures its pipeline’s tables.

    This example converts the reader back to a single-pipeline reader:

    terraform
    resource "artie_source_reader" "mysql_reader" {
      name           = "MySQL Production Reader"
      connector_uuid = artie_connector.mysql_prod.uuid
      database_name  = "app"
    
      is_shared = false # ← convert back to single-pipeline
    }

    Run terraform apply. Artie removes the shared reader’s standalone deployment and marks the pipeline as having undeployed changes.

    Open the pipeline in the dashboard. In the Changes not deployed yet banner, select Deploy changes. The pipeline then runs the reader in its own deployment, and you manage both from the dashboard.

    To run more online migrations later, leave is_shared = true and skip this step. A shared source reader works with one pipeline.

Next steps

Was this page helpful?