|
| 1 | +--- |
| 2 | +title: Move Azure Cache for Redis instances to different regions |
| 3 | +description: How to move Azure Cache for Redis instances to a different Azure region. |
| 4 | +author: curib |
| 5 | +ms.author: cauribeg |
| 6 | +ms.service: cache |
| 7 | +ms.topic: how-to |
| 8 | +ms.custom: subject-moving-resources |
| 9 | +ms.date: 8/27/2021 |
| 10 | +#Customer intent: As an Azure developer, I want to move my Azure Cache for Redis resource to another Azure region. |
| 11 | +--- |
| 12 | + |
| 13 | +# Move Azure Cache for Redis instances to different regions |
| 14 | + |
| 15 | +In this article, you learn how to move Azure Cache for Redis instances to a different Azure region. You might move your resources to another region for a number of reasons: |
| 16 | +- To take advantage of a new Azure region. |
| 17 | +- To deploy features or services available in specific regions only. |
| 18 | +- To meet internal policy and governance requirements. |
| 19 | +- To respond to capacity planning requirements. |
| 20 | + |
| 21 | +The tier of Azure Cache for Redis you use determines the option that's best for you. |
| 22 | + |
| 23 | +| Cache Tier | Options | |
| 24 | +| ------------ | ------- | |
| 25 | +| Premium | Geo-replication, create a new cache, dual-write to two caches, or export and import data via RDB file| |
| 26 | +| Basic or Standard | Create a new cache or dual-write to two caches| |
| 27 | +| Enterprise or Enterprise Flash | Create a new cache or export and import data with an RDB file | |
| 28 | + |
| 29 | +## Geo-replication (Premium) |
| 30 | + |
| 31 | +### Prerequisites |
| 32 | + |
| 33 | +To configure geo-replication between two caches, the following prerequisites must be met: |
| 34 | + |
| 35 | +- Both caches are [Premium tier](cache-overview.md#service-tiers) caches. |
| 36 | +- Both caches are in the same Azure subscription. |
| 37 | +- The secondary linked cache is either the same cache size or a larger cache size than the primary linked cache. |
| 38 | +- Both caches already exist and are running. |
| 39 | + |
| 40 | +### Prepare |
| 41 | + |
| 42 | +To move your cache instance to another region, you need to [create a second premium cache instance](quickstart-create-redis.md) in the desired region. Once both caches are running, you can set up geo-replication between the two cache instances. |
| 43 | + |
| 44 | +> [!NOTE] |
| 45 | +> Data transfer between Azure regions is charged at standard [bandwidth rates](https://azure.microsoft.com/pricing/details/bandwidth/). |
| 46 | +
|
| 47 | +Some features aren't supported with geo-replication: |
| 48 | + |
| 49 | +- Zone Redundancy isn't supported with geo-replication. |
| 50 | +- Persistence isn't supported with geo-replication. |
| 51 | + |
| 52 | +Conditions for geo-replications support: |
| 53 | + |
| 54 | +- Clustering is supported if both caches have clustering enabled and have the same number of shards. |
| 55 | +- Caches in different VNets are supported with caveats. See [Can I use geo-replication with my caches in a VNet?](cache-how-to-geo-replication.md#can-i-use-geo-replication-with-my-caches-in-a-vnet) for more information. |
| 56 | + |
| 57 | +After geo-replication is configured, the following restrictions apply to your linked cache pair: |
| 58 | + |
| 59 | +- The secondary linked cache is read-only. You can read from it, but you can't write any data to it. |
| 60 | + - If you choose to read from the Geo-Secondary instance, whenever a full data sync is happening between the Geo-Primary and the Geo-Secondary, such as when either Geo-Primary or Geo-Secondary is updated and on some reboot scenarios as well, |
| 61 | + the Geo-Secondary instance throws errors on any Redis operation against it until the full data sync between Geo-Primary and Geo-Secondary is complete. |
| 62 | + - Applications reading from Geo-Secondary should be built to fall back to the Geo-Primary whenever the Geo-Secondary is throwing such errors. |
| 63 | +- Any data that was in the secondary linked cache before the link was added is removed. If the geo-replication is later removed however, the replicated data remains in the secondary linked cache. |
| 64 | +- You can't [scale](cache-how-to-scale.md) either cache while the caches are linked. |
| 65 | +- You can't [change the number of shards](cache-how-to-premium-clustering.md) if the cache has clustering enabled. |
| 66 | +- You can't enable persistence on either cache. |
| 67 | +- You can [Export](cache-how-to-import-export-data.md#export) from either cache. |
| 68 | +- You can't [Import](cache-how-to-import-export-data.md#import) into the secondary linked cache. |
| 69 | +- You can't delete either linked cache, or the resource group that contains them, until you unlink the caches. For more information, see [Why did the operation fail when I tried to delete my linked cache?](cache-how-to-geo-replication.md#why-did-the-operation-fail-when-i-tried-to-delete-my-linked-cache) |
| 70 | +- If the caches are in different regions, network egress costs apply to the data moved across regions. For more information, see [How much does it cost to replicate my data across Azure regions?](cache-how-to-geo-replication.md#how-much-does-it-cost-to-replicate-my-data-across-azure-regions) |
| 71 | +- Automatic failover doesn't occur between the primary and secondary linked cache. For more information and information on how to failover a client application, see [How does failing over to the secondary linked cache work?](cache-how-to-geo-replication.md#how-does-failing-over-to-the-secondary-linked-cache-work) |
| 72 | + |
| 73 | +### Move |
| 74 | + |
| 75 | +1. To link two caches together for geo-replication, fist click **Geo-replication** from the Resource menu of the cache that you intend to be the primary linked cache. Next, click **Add cache replication link** from **Geo-replication** on the left. |
| 76 | + |
| 77 | + :::image type="content" source="media/cache-how-to-geo-replication/cache-geo-location-menu.png" alt-text="Add link"::: |
| 78 | + |
| 79 | +1. Select the name of your intended secondary cache from the **Compatible caches** list. If your secondary cache isn't displayed in the list, verify that the [Geo-replication prerequisites](#prerequisites) for the secondary cache are met. To filter the caches by region, select the region in the map to display only those caches in the **Compatible caches** list. |
| 80 | + |
| 81 | + :::image type="content" source="media/cache-how-to-geo-replication/cache-geo-location-select-link.png" alt-text="Geo-replication compatible caches"::: |
| 82 | + |
| 83 | + You can also start the linking process or view details about the secondary cache by using the context menu. |
| 84 | + |
| 85 | + :::image type="content" source="media/cache-how-to-geo-replication/cache-geo-location-select-link-context-menu.png" alt-text="Geo-replication context menu"::: |
| 86 | + |
| 87 | +1. Select **Link** to link the two caches together and begin the replication process. |
| 88 | + |
| 89 | + :::image type="content" source="media/cache-how-to-geo-replication/cache-geo-location-confirm-link.png" alt-text="Link caches"::: |
| 90 | + |
| 91 | +### Verify |
| 92 | + |
| 93 | +1. You can view the progress of the replication process using **Geo-replication** on the left. |
| 94 | + |
| 95 | + :::image type="content" source="media/cache-how-to-geo-replication/cache-geo-location-linking.png" alt-text="Linking status"::: |
| 96 | + |
| 97 | + You can also view the linking status on the left, using **Overview**, for both the primary and secondary caches. |
| 98 | + |
| 99 | + :::image type="content" source="media/cache-how-to-geo-replication/cache-geo-location-link-status.png" alt-text="Screenshot that highlights how to view the linking status for the primary and secondary caches."::: |
| 100 | + |
| 101 | + Once the replication process is complete, the **Link status** changes to **Succeeded**. |
| 102 | + |
| 103 | + :::image type="content" source="media/cache-how-to-geo-replication/cache-geo-location-link-successful.png" alt-text="Cache status"::: |
| 104 | + |
| 105 | + The primary linked cache remains available for use during the linking process. The secondary linked cache isn't available until the linking process completes. |
| 106 | + |
| 107 | +### Clean up source resources |
| 108 | + |
| 109 | +Once your new cache in the targeted region is populated with all necessary data, remove the link between the two caches and delete the original instance. |
| 110 | + |
| 111 | +1. To remove the link between two caches and stop geo-replication, click **Unlink caches** from the **Geo-replication** on the left. |
| 112 | + |
| 113 | + :::image type="content" source="media/cache-how-to-geo-replication/cache-geo-location-unlink.png" alt-text="Unlink caches"::: |
| 114 | + |
| 115 | + When the unlinking process completes, the secondary cache is available for both reads and writes. |
| 116 | + |
| 117 | +>[!NOTE] |
| 118 | +>When the geo-replication link is removed, the replicated data from the primary linked cache remains in the secondary cache. |
| 119 | +> |
| 120 | +> |
| 121 | +
|
| 122 | +2. Delete the original instance. |
| 123 | + |
| 124 | +## Create a new cache (All tiers) |
| 125 | + |
| 126 | +### Prerequisites |
| 127 | +- Azure subscription - [create one for free](https://azure.microsoft.com/free/) |
| 128 | + |
| 129 | +### Prepare |
| 130 | +If you don't need to maintain your data during the move, the easiest way to move regions is to create a new cache instance in the targeted region 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. |
| 131 | + |
| 132 | +### Move |
| 133 | + |
| 134 | +[!INCLUDE [redis-cache-create](includes/redis-cache-create.md)] |
| 135 | + |
| 136 | +Finally, update your application to use the new instances. |
| 137 | + |
| 138 | +### Clean up source resources |
| 139 | +Once your new cache in the targeted region is running, delete the original instance. |
| 140 | + |
| 141 | + |
| 142 | +## Export and import data with an RDB file (Premium, Enterprise, Enterprise Flash) |
| 143 | +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 and Enterprise](cache-overview.md#service-tiers) supports importing data into a cache instance with RDB files. You can use an RDB file to transfer data from an existing cache to Azure Cache for Redis. |
| 144 | + |
| 145 | +> [!IMPORTANT] |
| 146 | +> RDB file format can change between Redis versions and might not maintain backward-compatibility. The Redis version of the cache you're exporting from should be the same or lower than the version of your new cache instance. |
| 147 | +> |
| 148 | +
|
| 149 | +### Prerequisites |
| 150 | +- Both caches are [Premium tier or Enterprise tier](cache-overview.md#service-tiers) caches. |
| 151 | +- The second cache is either the same cache size or a larger cache size than the original cache. |
| 152 | +- The Redis version of the cache you're exporting from should be the same or lower than the version of your new cache instance. |
| 153 | + |
| 154 | +### Prepare |
| 155 | +To move your cache instance to another region, you'll need to create [a second premium cache instance](quickstart-create-redis.md) or [a second enterprise cache instance](quickstart-create-redis-enterprise.md) in the desired region. |
| 156 | + |
| 157 | +### Move |
| 158 | +1. See [here](cache-how-to-import-export-data.md) for more information on how to import and export data in Azure Cache for Redis. |
| 159 | + |
| 160 | +2. Update your application to use the new cache instance. |
| 161 | + |
| 162 | +### Verify |
| 163 | +You can monitor the progress of the import operation by following the notifications from the Azure portal, or by viewing the events in the [audit log](../azure-monitor/essentials/activity-log.md). |
| 164 | + |
| 165 | +### Clean up source resources |
| 166 | +Once your new cache in the targeted region is running, delete the original instance. |
| 167 | + |
| 168 | +## Dual-write to two caches (Basic, Standard, and Premium) |
| 169 | +Rather than moving data directly between caches, you can use your application to write data to both an existing cache and a new one you're setting up. The application initially reads 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. |
| 170 | + |
| 171 | +### Prerequisites |
| 172 | +- The second cache is either the same cache size or a larger cache size than the original cache. |
| 173 | + |
| 174 | +### Prepare |
| 175 | +To move your cache instance to another region, you'll need to [create a second cache instance](quickstart-create-redis.md) in the desired region. |
| 176 | + |
| 177 | +### Move |
| 178 | +General steps to implement this option are: |
| 179 | + |
| 180 | +1. Modify application code to write to both the new and the original instances. |
| 181 | + |
| 182 | +2. Continue reading data from the original instance until the new instance is sufficiently populated with data. |
| 183 | + |
| 184 | +3. Update the application code to reading and writing from the new instance only. |
| 185 | + |
| 186 | +### Clean up source resources |
| 187 | +Once your new cache in the targeted region is running, delete the original instance. |
| 188 | + |
| 189 | +## Next steps |
| 190 | + |
| 191 | +Learn more about Azure Cache for Redis features. |
| 192 | +- [Geo-replication FAQ](cache-how-to-geo-replication.md#geo-replication-faq) |
| 193 | +- [Azure Cache for Redis service tiers](cache-overview.md#service-tiers) |
| 194 | +- [High availability for Azure Cache for Redis](cache-high-availability.md) |
| 195 | + |
| 196 | + |
0 commit comments