For continuous migrations, you can initiate the promotion process when you are ready to cut over your applications to the destination databases. Promoting the migration job disconnects the destination AlloyDB for PostgreSQL cluster from the source and transforms it into an independent standalone primary cluster so you can direct application traffic to the cluster.
- Stop all writes, running scripts, and client connections to the source database. The cutover downtime window begins here.
- Wait until the
replication delay metric is at or close to zero. This ensures
that the migration job has processed all outstanding changes from the source.
You can promote a migration even if the replication delay isn't at zero. This can reduce database cutover time, but might affect data currency 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.
The migration job details page opens.
- On the migration job toolbar, click Promote.
The promote migration job dialog appears.
- In the dialog, ensure that no errors are displayed, and then click Promote.
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 migration job 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:
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: promote name: OPERATION_ID
To see if your operation is successful, you can query the returned operation object, or check the status of the migration job:
- 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 AlloyDB for PostgreSQL cluster is promoted. The destination cluster is
disconnected from the source, becomes an independent standalone primary cluster,
and is ready for full application traffic.
The migration job status changes to
Completed. - (Optional) Re-install extensions: If your source database used extensions that
aren't migrated by Database Migration Service (such as
pg_cron), re-install and configure those extensions on your destination cluster. - You can now connect your applications to the AlloyDB for PostgreSQL cluster and delete the completed migration job.