Migrate data to new subscription
There are times when you need to migrate data from one database to another.
Here are two common ways to do this.
Each approach is suitable for different situations and the steps can vary according to your needs.
Transfer via import
The most common way to transfer data to a new database is to import a copy of the data into it.
Here’s how it works:
-
Select an export storage destination and verify that it’s ready for use and has sufficient space.
-
Export the data from the original database to the storage location.
-
Import the exported data into the target database, the one hosted by the new subscription.
The migrated data reflects the state of the data at the time it was originally exported.
If you have apps or other connections actively using the source database, consider scheduling downtime for the migration to avoid loss.
This approach also lets you transfer data between databases hosted by different services.
Sync using Active-Passive
If your target database is hosted on a Flexible (or Annual) subscription, you can use Active-Passive to sync (synchronize) the source database to the target database. (The source database can be hosted on a Fixed, Flexible, or Annual subscription.)
The source database remains active while the data migrates.
To do this, specify the target database as an Active-Passive replica of the the source database. The general process is:
- Get the public endpoint of the source database.
- Enable the target database as an Active-Passive replica for the source.
- Wait for the data to sync.
- Switch apps and other connections to the target database.
- Disable Active-Passive for the target database.
You need the public endpoint details for the source database. These are available from the database list and the General section of the Configuration tab for the source database.
Here’s how this works for databases hosted on the same account:
-
Select Databases from the admin menu and select the source database in the list.
-
Select the Copy button next to the Public endpoint details for the source database to copy the endpoint details to the Clipboard.
-
Use the database list drop-down to select the target database.
-
From the Configuration tab of the target database, select Edit database.
-
In the Durability section, enable Active-Passive Redis and then select Add URI.
-
In the text box, type
redis://
and then paste in the public endpoint details.Select Save to make sure you’ve specified the source URI correctly.
If the endpoint cannot be verified, make sure that you’ve copied the details directly from the source database and that the value you entered starts with
redis://
. -
Select Save Database to begin updating the database.
Initially, the database status is Pending, which means the update task is still running.
The sync process doesn’t begin until the database becomes
Active
.When data has fully migrated to the target database, database status reports
Synced
.
Active-Passive sync lets you migrate data while apps and other connections are using the source database. Once the data is migrated, you should migrate active connections to the target database.
Active-Passive memory requirements
Active-Passive sync requires more memory than data import. On average, you need an extra 25% memory on top of other requirements, though specific requirements depend on the data types and other factors.
To illustrate, suppose you want to migrate a 1 GB source database without replication to a target database with replication enabled. Here, the target database memory limit should be at least 2.5 GB to avoid data loss.
Once the databases are synced, you can disable Active-Passive for the target database. Before doing so, however, verify that apps and other connections have switched to the target database; otherwise, you may lose data.