For continuous migrations, you can initiate the promotion process after it's time to move reads and writes to the destination databases. Promotion means that the migrated Cloud SQL databases become now accessible for all read and write operations.
You can promote a migration job or promote selected databases from a migration job.
- Stop all writes, running scripts, and client connections to the source database. The downtime period begins here.
- Make sure that all the available data from transaction log files is replicated to the Cloud SQL destination instance.
- Wait until the
replication delay metric is at or close to zero. This means
that the migration job has processed all outstanding changes.
You can promote a migration even if the replication delay isn't at zero. This can reduce the database downtime, but may affect the accuracy of the data in the destination.
- Perform the promote action:
Console
- In the Google Cloud console, go to the Migration jobs page.
- On the Jobs tab, click the display name of the migration job that you want to promote.
- Perform one of the following promote actions:
If you want to promote all databases included in the migration, on the migration job's toolbar, click Promote.
The promote migration job dialog appears.
If you want to promote only specific databases, select them using the checkboxes next to the database names and on the Databases tab, click Promote.
The dialog with a number of databases that you want to promote appears.
- In the dialog, ensure that no errors are displayed, and then click Promote.
The migration job details page opens.
gcloud
Before using any of the command data below, make the following replacements:
- MIGRATION_JOB_ID with
your migration job identifier.
If you don't know the identifier, you can use the
gcloud database-migration migration-jobs listcommand to list all migration jobs in a given region and view their identifiers. - REGION with the identifier of the region where your connection profile is saved.
Execute the following command:
Linux, macOS, or Cloud Shell
gcloud database-migration migration-jobs \ promote MIGRATION_JOB_ID \ --region=REGION
Windows (PowerShell)
gcloud database-migration migration-jobs ` promote MIGRATION_JOB_ID ` --region=REGION
Windows (cmd.exe)
gcloud database-migration migration-jobs ^ promote MIGRATION_JOB_ID ^ --region=REGION
Result
The action is performed in an asynchronous manner. As such, this command returns an Operation entity that represents a long-running operation:
To see if your operation is successful, you can query the returned operation object, or check the status of the migration job:done: false metadata: '@type': type.googleapis.com/google.cloud.clouddms.v1.OperationMetadata apiVersion: v1 createTime: '2024-02-20T12:20:24.493106418Z' requestedCancellation: false target: MIGRATION_JOB_ID verb: start name: OPERATION_ID
- Use the
gcloud database-migration migration-jobs describecommand with the MIGRATION_JOB_ID to view the status of the migration job. - Use the
gcloud database-migration operations describecommand with the OPERATION_ID to see the status of the operation itself.
- The destination instance or the databases that you selected are promoted,
and your migrated databases are now accessible for all read and write operations.
The migration job status changes to
Completed. - The application can now be connected to the Cloud SQL instance and the migration job can be safely deleted.
What's next
- Verify migration data for completeness.
- Optional: Set up cascading read replicas for your promoted Cloud SQL instance.