%3CLINGO-SUB%20id%3D%22lingo-sub-1781923%22%20slang%3D%22en-US%22%3EMigrate%20Large%20Azure%20MySQL%20Between%20Subscriptions%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1781923%22%20slang%3D%22en-US%22%3E%3CP%3EBecause%20of%20the%20time%20involved%20and%20that%20it%20was%20a%20live%20production%20system%20finding%20a%20quicker%20way%20was%20needed%20instead%20of%20making%20an%20extended%20downtime%20for%20a%20customer%20facing%20solution.%26nbsp%3B%20We%20worked%20out%20a%20solution%20that%20would%20minimize%20downtime%20and%20allow%20a%20seamless%20migration.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3COL%3E%0A%3CLI%3EFirst%20we%20had%20to%20check%20that%20the%20regions%20we%20were%20working%20with%20was%20supported%20for%20%3CA%20title%3D%22MySQL%20cross%20region%20replication%22%20href%3D%22https%3A%2F%2Fdocs.microsoft.com%2Fen-us%2Fazure%2Fmysql%2Fconcepts-read-replicas%23cross-region-replication%22%20target%3D%22_self%22%20rel%3D%22noopener%20noreferrer%20noopener%20noreferrer%22%3EMySQL%20cross%20region%20replication%3C%2FA%3E.%3C%2FLI%3E%0A%3CLI%3EBecause%20you%20can't%20do%20cross%20region%20replication%20between%20subscriptions%20though%2C%20you%20will%20need%20to%20first%20%3CA%20title%3D%22create%20a%20MySQL%20read%20replica%22%20href%3D%22https%3A%2F%2Fdocs.microsoft.com%2Fen-us%2Fazure%2Fmysql%2Fhowto-read-replicas-portal%23create-a-read-replica%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noopener%20noreferrer%20noopener%20noreferrer%22%3Ecreate%20a%20read%20replica%3C%2FA%3E%20in%20the%20current%20subscription%20in%20the%20new%20region.%3C%2FLI%3E%0A%3CLI%3EAfter%20the%20replica%20is%20created%20move%20the%20replica%20server%20to%20the%20new%20subscription%20(this%20can%20be%20done%20in%20the%20Resource%20Group%20screen%2C%20select%20the%20replica%20server%20and%20in%20the%20%3CSTRONG%3EMove%3C%2FSTRONG%3E%20dropdown%20choose%20%3CSTRONG%3EMove%20to%20another%20subscription%3CBR%20%2F%3E%3C%2FSTRONG%3E%3C%2FLI%3E%0A%3CLI%3EAfter%20the%20move%2C%20check%20that%20the%20%3CA%20title%3D%22replication%20lag%20is%20zero%22%20href%3D%22https%3A%2F%2Fdocs.microsoft.com%2Fen-us%2Fazure%2Fmysql%2Fconcepts-read-replicas%23monitor-replication%22%20target%3D%22_self%22%20rel%3D%22noopener%20noreferrer%20noopener%20noreferrer%22%3Ereplication%20lag%20is%20zero%3C%2FA%3E%2C%20take%20the%20original%20app%20down%20for%20a%20short%20maintenance%20window%2C%20and%20stop%20replication%20to%20make%20the%20replica%20a%20standalone%20server.%3C%2FLI%3E%0A%3CLI%3ERedirect%20traffic%20to%20the%20new%20region%20with%20the%20now%20standalone%20MySQL%20server%20in%20the%20new%20region%20and%20subscription%20in%20a%20fraction%20of%20the%20time%20it%20was%20taking%20with%20a%20backup%20and%20restore.%3C%2FLI%3E%0A%3C%2FOL%3E%0A%3CP%3EThis%20allowed%20the%20customer%20to%20migrate%20his%20application%20and%20database%20in%20much%20less%20time%20to%20the%20new%20subscription%20and%20region.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-TEASER%20id%3D%22lingo-teaser-1781923%22%20slang%3D%22en-US%22%3E%3CP%3ERecently%20worked%20with%20a%20customer%20that%20was%20not%20only%20migrating%20their%20Azure%20MySQL%20from%20one%20region%20to%20another%2C%20but%20also%20from%20one%20subscription%20to%20another.%26nbsp%3B%20The%20database%20was%20large%20enough%20that%20a%20backup%20and%20restore%20was%20taking%20over%204%20hours.%3C%2FP%3E%3C%2FLINGO-TEASER%3E%3CLINGO-LABS%20id%3D%22lingo-labs-1781923%22%20slang%3D%22en-US%22%3E%3CLINGO-LABEL%3EInfrastructure%3C%2FLINGO-LABEL%3E%3C%2FLINGO-LABS%3E
Microsoft

Because of the time involved and that it was a live production system finding a quicker way was needed instead of making an extended downtime for a customer facing solution.  We worked out a solution that would minimize downtime and allow a seamless migration.

 

  1. First we had to check that the regions we were working with was supported for MySQL cross region replication.
  2. Because you can't do cross region replication between subscriptions though, you will need to first create a read replica in the current subscription in the new region.
  3. After the replica is created move the replica server to the new subscription (this can be done in the Resource Group screen, select the replica server and in the Move dropdown choose Move to another subscription
  4. After the move, check that the replication lag is zero, take the original app down for a short maintenance window, and stop replication to make the replica a standalone server.
  5. Redirect traffic to the new region with the now standalone MySQL server in the new region and subscription in a fraction of the time it was taking with a backup and restore.

This allowed the customer to migrate his application and database in much less time to the new subscription and region.