Downgrade an MP service layer to an MS service layer
Because MP service layers use different storage schema to MS service layers, MySQL Database on Azure does not currently support directly downgrading from MP to MS. If you are certain that you need to perform this type of downgrade operation, it can be accomplished by first creating a subordinate instance and then promoting it to a master instance. The specific steps are shown below (a downgrade from MP1 to MS6 is given as an example; the downgrade operation for other service layers is similar).
The names of the resources involved in this example are given in the table below:
Resource | MP1 | MS6 |
Resource group | Default-MySQL-ChinaEast | Default-MySQL-ChinaEast |
Server | mysqldemoserver | mysqlmsserver |
Location | ChinaEast | ChinaEast |
Test database | replicadb | replicadb |
Step 1 Wait for MP to automatically create a complete backup
Ensure that there is at least one complete backup of the MP1 instance, and that the backup status is “Ready.” Depending on your settings, this process might take up to one day.
Step 2 Create an MS subordinate instance
To create an MS6 subordinate (read-only) instance, run the following PowerShell command:
New-AzureRmResource -ResourceType "Microsoft.MySql/servers" -ResourceName mysqlmsserver -ApiVersion 2015-09-01 -ResourceGroupName Default-MySql-ChinaEast -Location ChinaEast -SkuObject @{name='MS6'} -Properties @{replicationMode='AzureSlave'; creationSource=@{server='mysqldemoserver';region='chinaEast'}; version = '5.6';}
Step 3 Suspend a client’s database write operations
Wait until the latency between the subordinate instance (MS6) and the master instance (MP1) is sufficiently low (for example, less than 60 seconds), and then suspend all of the client program’s write operations on the MP1 master instance.
Step 4 Create a test database on the MP master instance to use as a synchronization signal
Create the replicadb database on the MP1 master instance, and then wait until this test database has synced to the MS6 subordinate instance. The data on the two instances is now fully synced.
Step 5 Promote the subordinate instance to a master instance
Promote the MS6 subordinate instance to a master instance. (Refer to: Promote subordinate instances)
Finally, you can modify the client program connection string so that it points to the new MS6 instance, and then delete the MP1 instance.
Note
In certain situations, it might be inconvenient to modify the client program connection string. We have provided a process for your reference in which there is no need to modify the client program connection string. The following steps do not require you to modify the client program connection string, but they might temporarily cause downtime for upper layer applications (usually for a few minutes).
Step 6 Create a manual backup in the Azure classic portal
Create a manual instant backup of the MS6 instance. For more information, see Backup and restore a MySQL Database on Azure.
Step 7 Restore the backup to an MS instance with the same name as the original MP instance
Delete the MP1 instance, and then restore the manual instant backup created in Step 6 to a new MS6 instance with the same name as the original MP1 instance (mysqldemoserver in this example).
Finally, delete the temporary MS6 instance mysqldemoserver, and then restore the client program’s normal read and write operations on the MS6 instance.