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:
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:
After the new pipeline has backfilled and caught up to the source, you delete the old pipeline:
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_connectorresource. - You have a list of every table that either pipeline replicates. A shared source reader captures only the tables in its
tablesblock. - 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
Promote the existing source reader to shared
Set
is_shared = trueon the source reader and add atablesblock that lists every table the reader captures. The provider rejects a shared reader that has notablesblock.This example shares a MySQL source reader that captures two tables:
terraformresource "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 setscolumns_to_includeorcolumns_to_exclude, that list applies to every pipeline on the reader.Run
terraform planand confirm that the source reader is the only resource that changes. Then runterraform apply. Terraform updates the reader and deploys it as a shared source reader.Create the new pipeline against the same source reader
Add a second
artie_pipelineresource with the samesource_reader_uuidas your existing pipeline and a different destination database. This example writes the new pipeline to the Snowflake databaseANALYTICS_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 intoANALYTICS_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
tablesblock. If one is missing, Artie rejects the pipeline with this error:Textshared source reader does not have a table config for table "app.orders"Let the new pipeline backfill and catch up
One source reader now feeds two pipelines. The old pipeline writes to
ANALYTICS_V1and the new pipeline writes toANALYTICS_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_V2with row counts, spot checks and your downstream queries before you cut over.Cut over and delete the old pipeline
Cut over after you confirm that the new pipeline has caught up and the data in
ANALYTICS_V2is correct:- Point your downstream consumers at the new database.
- Remove the old pipeline’s resource block from your Terraform configuration.
- Run
terraform apply.
Terraform deletes the old pipeline. The shared source reader keeps running and feeds only the new pipeline.
(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:
TextOther pipelines share this source's settings, so change them in Terraform.To edit the reader from the dashboard again, set
is_shared = falseand remove thetablesblock. The provider rejects atablesblock 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:
terraformresource "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 = trueand skip this step. A shared source reader works with one pipeline.
Next steps
- To keep both pipelines running, follow Write to multiple destinations. A shared source reader can feed more than two pipelines, for example Snowflake and S3 from the same source.
- For how pipelines share one reader, see Writing to multiple destinations.
- For how a new pipeline’s backfill runs next to CDC, see Backfills.
Was this page helpful?
- Need help? Message us on Slack or email [email protected].
- Want a walkthrough? Book a demo.
- LLM? Read llms.txt.