A->B->C Migrations
Important
Cluster-to-Cluster Sync Beta Program
This feature is only available in mongosync
beta. To learn more,
see Cluster-to-Cluster Sync Beta Program.
Starting in mongosync
beta 1.8, you can perform A->B->C migrations.
A->B->C migrations allow you to perform two consecutive migrations, where the
destination cluster of the first migration acts as the source cluster for the
second migration.
Syntax
To perform an A->B->C migration, run the following commands when starting mongosync:
./bin/mongosync \ --cluster0 <cluster-A-connection-string> \ --cluster1 <cluster-B-connection-string> \ --migrationName <string> ./bin/mongosync \ --cluster0 <cluster-B-connection-string> \ --cluster1 <cluster-C-connection-string> \ --migrationName <string>
To start the sync operation between the source and destination clusters, see Synchronize Data Between Clusters.
Behavior
The first migration (A->B) must finish committing before the second migration (B->C) starts committing.
Warning
If the second migration starts committing before the first migration finishes, you may experience data loss.
Before you use any experimental mongosync
beta features,
review the Cluster-to-Cluster Sync Beta Program Disclaimer.
For better performance, ensure that the first migration (A->B) reaches
change event application
before the second migration (B->C) starts. To
see if a migration reached change event application
, check the info
field in the progress
response document.
Cluster B Size
Writes from cluster A and reads from cluster C can result in heavy loads for cluster B. Ensure that cluster B is sufficiently sized and can handle simultaneous read and write loads.
Migration Name
The migrationName
string can contain up to 44 alphanumeric and underscore
characters. migrationName
is appended to the string
"mongosync_internal_"
to set the migration metadata database name.
For example, if you set migrationName
to
"cluster_27000_to_cluster_35000_sync"
, the resulting mongosync
metadata
database name is "mongosync_internal_cluster_27000_to_cluster_35000_sync"
.
Verification
A->B->C Migrations is not compatible with the Embedded Verifier. The /start command returns an error if you enable both the verifier and A->B->C Migrations.
For more information, see Verify Data Transfer.
Example
The following example performs two consecutive migrations that:
Connect a source cluster running on port
27000
with a destination cluster running on port27001
.Use the destination cluster running on port
27001
as a source cluster for the second migration.Connect the source cluster on port
27001
with a destination cluster running on port27002
.
The command also sets --migrationName
to describe the operations and store migration metadata for each
sync.
./bin/mongosync \ --cluster0 "mongodb://localhost:27000" \ --cluster1 "mongodb://localhost:27001" \ --migrationName "cluster_27000_to_cluster_27001_sync" ./bin/mongosync \ --cluster0 "mongodb://localhost:27001" \ --cluster1 "mongodb://localhost:27002" \ --migrationName "cluster_27001_to_cluster_27002_sync"