Skip to content

Commit 8e518d8

Browse files
committed
draft migrate
1 parent 1f66a8d commit 8e518d8

File tree

1 file changed

+44
-68
lines changed

1 file changed

+44
-68
lines changed
Lines changed: 44 additions & 68 deletions
Original file line numberDiff line numberDiff line change
@@ -1,122 +1,98 @@
11
---
22
title: Migrate to Azure Cache for Redis
3-
description: Learn how to migrate your existing cache to Azure Cache for Redis
3+
description: Learn how to migrate an existing cache to Azure Cache for Redis or migrate between Azure Cache for Redis instances.
44
ms.topic: conceptual
55
ms.custom:
66
- ignite-2024
77
ms.collection:
88
- migration
99
- aws-to-azure
10-
ms.date: 11/17/2021
10+
ms.date: 05/22/2025
1111
appliesto:
1212
- ✅ Azure Cache for Redis
1313

1414
---
15-
# Migrate to Azure Cache for Redis
15+
# Migrate to or between Azure Cache for Redis instances
1616

17-
This article describes a number of approaches to migrate an existing Redis cache running on-premises or in another cloud service to Azure Cache for Redis.
17+
This article describes several Azure Cache for Redis migration scenarios.
1818

19-
## Migration scenarios
19+
- Migrate Redis caches running in private data centers, on cloud virtual machines (VMs), or in another cloud to Azure Cache for Redis.
20+
- Migrate one Azure Cache for Redis instance to another instance.
21+
- (Migrate an ACR instance to an AMR instance?)
2022

21-
Open-source Redis can run in many compute environments. Common examples include:
23+
If you only need to move an Azure Redis cache from one Azure region to another, see [Move Azure Cache for Redis instances to different regions](cache-moving-resources.md) article.
2224

23-
- **On-premises** - Redis caches running in private data centers.
24-
- **Cloud-based VMs** - Redis caches running on Azure VMs, AWS EC2, and so on.
25-
- **Hosting services** - Managed Redis services such as AWS ElastiCache.
26-
27-
If you have such a cache, you may be able to move it to Azure Cache for Redis with minimal interruption or downtime.
28-
29-
If you're looking to move from one Azure region to another, we recommend you see our [Move Azure Cache for Redis instances to different regions](cache-moving-resources.md) article.
25+
Open-source Redis can run in many compute environments, such as private on-premises data centers or cloud-hosted virtual machines (VMs). Other hosting platforms like Amazon Web Services (AWS) host Redis cache services like AWS ElastiCache. You can usually migrate these Redis caches to Azure Cache for Redis with minimal interruption or downtime.
3026

3127
## Migration options
3228

33-
There are different ways that you can switch from one cache to another. Depending on where your cache is and how your application interacts with it, one method will be more useful than the others. Some of the frequently used migration strategies are detailed below.
29+
How you migrate from one cache to another depends on where your cache exists and how your application interacts with it. The following table lists the frequently used migration strategies.
3430

3531
| Option | Advantages | Disadvantages |
3632
| ------------ | ---------- | ------------- |
37-
| Create a new cache | Simplest to implement. | Need to repopulate data to the new cache, which may not work with many applications. |
38-
| Export and import data via RDB file | Compatible with any Redis cache generally. | Some data could be lost, if they're written to the existing cache after the RDB file is generated. |
39-
| Dual-write data to two caches | No data loss or downtime. Uninterrupted operations of the existing cache. Easier testing of the new cache. | Needs two caches for an extended period of time. |
40-
| Migrate data programmatically | Full control over how data are moved. | Requires custom code. |
33+
| Create a new cache | Simplest to implement. | Must repopulate data to the new cache, which might not work with some applications. |
34+
| Export and import data via read-only database (RDB) file. | Usually compatible with any Redis cache. | Data written to the existing cache after the RDB file is generated could be lost. |
35+
| Dual-write data to two caches. | No data loss or downtime, uninterrupted cache operations, and easier testing. | Needs two caches for an extended time period. |
36+
| Migrate data programmatically. | Full control over how data is moved. | Requires custom code. |
4137

42-
### Create a new Azure Cache for Redis
38+
### Create a new cache
4339

44-
This approach technically isn't a migration. If losing data isn't a concern, the easiest way to move to Azure Cache for Redis is to create cache instance and connect your application to it. For example, if you use Redis as a look-aside cache of database records, you can easily rebuild the cache from scratch.
40+
If uninterrupted operations and potential data loss aren't concerns, the easiest way to move data to Azure Cache for Redis is to create an Azure Redis cache instance and connect your application to it. This approach isn't technically a migration. For example, if you use Redis as a look-aside cache of database records, you can easily rebuild the cache from scratch.
4541

4642
General steps to implement this option are:
4743

48-
1. Create a new Azure Cache for Redis instance.
49-
50-
1. Optionally, try out the new [Azure Managed Redis (preview)](../redis/overview.md).
51-
52-
2. Update your application to use the new instance.
53-
44+
1. Create a new Azure Cache for Redis instance. Optionally, try out [Azure Managed Redis](../redis/overview.md).
45+
1. Update your application to use the new Azure Redis instance.
5446
3. Delete the old Redis instance.
5547

5648
### Export data to an RDB file and import it into Azure Cache for Redis
5749

58-
Open-source Redis defines a standard mechanism for taking a snapshot of a cache's in-memory dataset and saving it to a file. This file, called RDB, can be read by another Redis cache. [Azure Cache for Redis premium tier](cache-overview.md#service-tiers) supports importing data into a cache instance via RDB files. You can use an RDB file to transfer data from an existing cache to Azure Cache for Redis.
50+
Open-source Redis defines a standard mechanism to take a snapshot of a cache's in-memory dataset and save it to an RDB file that any Redis cache can read. Azure Cache for Redis [Premium tier](cache-overview.md#service-tiers) supports importing data into a cache instance via RDB file. You can use an RDB file to transfer data from an existing cache to Azure Cache for Redis.
5951

6052
> [!IMPORTANT]
61-
> RDB file format can change between Redis versions and may not maintain backward-compatibility. The Redis version of the cache you're exporting from should be equal or less than the version provided by Azure Cache for Redis.
62-
>
53+
> RDB file format can change between Redis versions and might not maintain backward compatibility. The Redis version of the cache you export should be equal to or lower than the version that Azure Cache for Redis provides.
6354
6455
General steps to implement this option are:
6556

66-
1. Create a new Azure Cache for Redis instance in the premium tier that is the same size as (or bigger than) the existing cache.
57+
1. Save a snapshot of the existing Redis cache. You can [configure Redis to save snapshots](https://redis.io/topics/persistence) periodically, or save manually using the [SAVE](https://redis.io/commands/save) or [BGSAVE](https://redis.io/commands/bgsave) commands. The RDB file is named *dump.rdb* by default and is located at the path specified in the *redis.conf* configuration file.
58+
1. Create a new Premium-tier Azure Cache for Redis instance that's at least as large as the existing cache.
59+
1. Copy the RDB file to an Azure storage account in the region where your new cache is located. You can use `AzCopy` for this task.
60+
1. [Import the RDB file into the new cache](cache-how-to-import-export-data.md). You can also use the [PowerShell Import cmdlet](/powershell/module/az.rediscache/import-azrediscache).
61+
1. Update your application to use the new cache instance.
6762

68-
2. Save a snapshot of the existing Redis cache. You can [configure Redis to save snapshots](https://redis.io/topics/persistence) periodically, or run the process manually using the [SAVE](https://redis.io/commands/save) or [BGSAVE](https://redis.io/commands/bgsave) commands. The RDB file is named “dump.rdb” by default and will be located at the path specified in the *redis.conf* configuration file.
69-
70-
> [!NOTE]
71-
> If you’re migrating data within Azure Cache for Redis, see [these instructions on how to export an RDB file](cache-how-to-import-export-data.md) or use the [PowerShell Export cmdlet](/powershell/module/az.rediscache/export-azrediscache) instead.
72-
>
73-
74-
3. Copy the RDB file to an Azure storage account in the region where your new cache is located. You can use AzCopy for this task.
75-
76-
4. Import the RDB file into the new cache using these [import instructions](cache-how-to-import-export-data.md) or the [PowerShell Import cmdlet](/powershell/module/az.rediscache/import-azrediscache).
63+
> [!NOTE]
64+
> To migrate data from another Azure Redis instance, first [export the RDB file](cache-how-to-import-export-data.md) from that instance, or use the [PowerShell Export cmdlet](/powershell/module/az.rediscache/export-azrediscache).
7765
78-
5. Update your application to use the new cache instance.
66+
### Write to two Redis caches during migration
7967

80-
### Write to two Redis caches simultaneously during migration period
68+
Rather than moving data between caches, you can temporarily set your application to write data to both an existing cache and a new one. The application reads data from the existing cache initially. When the new cache has enough data, you switch the application to that cache and retire the old one.
8169

82-
Rather than moving data directly between caches, you may use your application to write data to both an existing cache and a new one you're setting up. The application will still read data from the existing cache initially. When the new cache has the necessary data, you switch the application to that cache and retire the old one. Let's say, for example, you use Redis as a session store and the application sessions are valid for seven days. After writing to the two caches for a week, you'll be certain the new cache contains all non-expired session information. You can safely rely on it from that point onward without concern over data loss.
70+
For example, suppose you use Redis as a session store and the application sessions expire after seven days. After writing to both caches for seven days, you know the new cache contains all nonexpired session information and you can safely rely on it from that point onward.
8371

8472
General steps to implement this option are:
8573

86-
1. Create a new Azure Cache for Redis instance in the premium tier that is the same size as (or bigger than) the existing cache.
87-
88-
2. Modify application code to write to both the new and the original instances.
89-
90-
3. Continue reading data from the original instance until the new instance is sufficiently populated with data.
91-
92-
4. Update the application code to reading and writing from the new instance only.
93-
94-
5. Delete the original instance.
74+
1. Create a new Premium-tier Azure Cache for Redis instance that's at least as large as the existing cache.
75+
1. Modify your application code to write to both the new and the original instances.
76+
1. Continue using data from the original instance until the new instance is sufficiently populated with data.
77+
1. Update the application code to reading and writing from the new instance only.
78+
1. Delete the original instance.
9579

9680
### Migrate programmatically
9781

98-
You can create a custom migration process by programmatically reading data from an existing cache and writing them into Azure Cache for Redis. This [open-source tool](https://github.com/deepakverma/redis-copy) can be used to copy data from one Azure Cache for Redis instance to another. A [compiled version](https://github.com/deepakverma/redis-copy/releases/download/alpha/Release.zip) is available as well. You may also find the source code to be a useful guide for writing your own migration tool.
82+
You can create a custom migration process by programmatically reading data from an existing cache and writing it into Azure Cache for Redis. For example, you can use this open-source [redis-copy](https://github.com/deepakverma/redis-copy) tool to copy data from one Azure Redis instance to another.
83+
84+
The source code can be a useful guide for writing your own migration tool. A [compiled version](https://github.com/deepakverma/redis-copy/releases/download/alpha/Release.zip) is also available.
9985

10086
> [!NOTE]
10187
> This tool isn't officially supported by Microsoft.
102-
>
10388
10489
General steps to implement this option are:
10590

106-
1. Create a VM in the region where the existing cache is located. If your dataset is large, choose a relatively powerful VM to reduce copying time.
107-
108-
2. Create a new Azure Cache for Redis instance.
109-
110-
3. Flush data from the new cache to ensure that it's empty. This step is required because the copy tool itself doesn't overwrite any existing key in the target cache.
111-
112-
> [!IMPORTANT]
113-
> Make sure to NOT flush from the source cache.
114-
>
115-
116-
4. Use an application such as the open-source tool above to automate the copying of data from the source cache to the target. Remember that the copy process could take a while to complete depending on the size of your dataset.
91+
1. Create an Azure virtual machine (VM) in the same region as the existing cache. If your dataset is large, choose a powerful VM to reduce copying time.
92+
1. Create a new Azure Cache for Redis instance and make sure that it's empty. The `redis-copy` tool doesn't overwrite any existing keys in the target cache.
93+
4. Use an application such as `redis-copy` to automate copying the data from the source cache to the target cache. The copy process could take awhile depending on the size of your dataset.
11794

118-
## Next steps
119-
Learn more about Azure Cache for Redis features.
95+
## Related content
12096

121-
* [Azure Cache for Redis service tiers](cache-overview.md#service-tiers)
122-
* [Import data](cache-how-to-import-export-data.md#import)
97+
- [Azure Cache for Redis service tiers](cache-overview.md#service-tiers)
98+
- [Import and export data](cache-how-to-import-export-data.md#import)

0 commit comments

Comments
 (0)