You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: articles/azure-cache-for-redis/cache-tutorial-active-replication.md
+29-20Lines changed: 29 additions & 20 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,12 +1,12 @@
1
1
---
2
-
title: 'Tutorial: Get started with leveraging Azure Cache for Redis Enterprise active replication with your AKShosted application'
2
+
title: 'Tutorial: Get started with leveraging Azure Cache for Redis Enterprise active replication with an AKS-hosted application'
3
3
description: In this tutorial, you learn how to connect your AKS hosted application to Azure Cache for Redis Enterprise instances and leverage active geo-replication.
4
4
author: flang-msft
5
5
6
6
ms.author: franlanglois
7
7
ms.service: cache
8
8
ms.topic: tutorial
9
-
ms.date: 09/07/2023
9
+
ms.date: 09/18/2023
10
10
#CustomerIntent: As a developer, I want to see how to use a Azure Cache for Redis Enterprise instance with an AKS container so that I see how I can use my cache instance with a Kubernetes cluster.
11
11
12
12
---
@@ -15,10 +15,6 @@ ms.date: 09/07/2023
15
15
16
16
In this tutorial, you will host a simple inventory application on AKS and find out how you can leverage active geo-replication to replicate data in your Azure Cache for Redis Enterprise instances across Azure regions.
17
17
18
-
## Overview
19
-
This tutorial uses a sample inventory page which shows three different T-shirt options. The user can "purchase" each T-shirt and see the inventory drop. The unique thing about this demo is that we run the inventory app in two different regions. Typically, you would have to run the database storing inventory data in a single region so that there are no consistency issues. That can result in unpleasant customer experience due to higher latency for calls across different Azure regions. By using Azure Cache for Redis Enterprise as the backend, however, you can link two caches together with active geo-replication so that the inventory remains consistent across both regions while enjoying low latency performance from Redis Enterprise in the same region.
20
-
21
-
22
18
## Prerequisites
23
19
24
20
- An Azure subscription. If you don't have an Azure subscription, create a [free account](https://azure.microsoft.com/free/?WT.mc_id=A261C142F).
@@ -27,26 +23,33 @@ This tutorial uses a sample inventory page which shows three different T-shirt o
27
23
> [!IMPORTANT]
28
24
> This tutorial assumes that you are familiar with basic Kubernetes concepts like containers, pods and service.
29
25
26
+
## Overview
27
+
28
+
This tutorial uses a sample inventory page which shows three different T-shirt options. The user can "purchase" each T-shirt and see the inventory drop. The unique thing about this demo is that we run the inventory app in two different regions. Typically, you would have to run the database storing inventory data in a single region so that there are no consistency issues. That can result in unpleasant customer experience due to higher latency for calls across different Azure regions. By using Azure Cache for Redis Enterprise as the backend, however, you can link two caches together with active geo-replication so that the inventory remains consistent across both regions while enjoying low latency performance from Redis Enterprise in the same region.
29
+
30
30
## Set up an Azure Cache for Redis instance
31
31
32
-
1. Create a new Azure Cache for Redis Enterprise instance in **West US 2** region by using the Azure portal or your preferred CLI tool. Alternately, you can use any region of your choice. Use the [quickstart guide](quickstart-create-redis-enterprise.md) to get started.
33
-
1. On the **Advanced** tab,
34
-
* enable **Non-TLS access only**
35
-
* set **Clustering Policy** to Enterprise
36
-
* set up active geo-replication using [this guide](cache-how-to-active-geo-replication.md)
32
+
1. Create a new Azure Cache for Redis Enterprise instance in **West US 2** region by using the Azure portal or your preferred CLI tool. Alternately, you can use any region of your choice. Use the [quickstart guide](quickstart-create-redis-enterprise.md) to get started.
33
+
34
+
1. On the **Advanced** tab:
35
+
36
+
- Enable **Non-TLS access only**.
37
+
- set **Clustering Policy** to Enterprise
38
+
- set up active geo-replication using [this guide](cache-how-to-active-geo-replication.md)
37
39
38
40
> [!IMPORTANT]
39
41
> This tutorial uses a non-TLS port for demonstration, but we highly recommend that you use a TLS port for anything in production.
40
42
41
-
3. Set up another Azure Cache for Redis Enterprise in **East US** region with the exact same configuration as the first cache. Alternately, you can use any region of your choice. Ensure that you choose the same replication group as the first cache.
43
+
1. Set up another Azure Cache for Redis Enterprise in **East US** region with the exact same configuration as the first cache. Alternately, you can use any region of your choice. Ensure that you choose the same replication group as the first cache.
42
44
43
45
## Prepare Kubernetes deployment files
44
46
45
-
To demonstrate data replication across regions, we will run two instances of the same application in different regions. Let's assume one instance runs in Seattle (west) while the second in New York(east).
47
+
To demonstrate data replication across regions, we will run two instances of the same application in different regions. Let's assume one instance runs in Seattle (west) while the second in New York(east).
46
48
47
49
Update the following fields in the YAML file below and save it as app_west.yaml
48
-
* Update environment variables REDIS_HOST and REDIS_PASSWORD with hostname and access key of your Azure Cache for Redis Enterprise instance in West US 2 or one of the two regions your chose earlier.
49
-
* Update APP_LOCATION to display the region where this application instance is running. In this sample, we are configuring the APP_LOCATION to Seattle to indicate this application instance is running in Seattle.
50
+
51
+
- Update environment variables REDIS_HOST and REDIS_PASSWORD with hostname and access key of your Azure Cache for Redis Enterprise instance in West US 2 or one of the two regions your chose earlier.
52
+
- Update APP_LOCATION to display the region where this application instance is running. In this sample, we are configuring the APP_LOCATION to Seattle to indicate this application instance is running in Seattle.
50
53
51
54
```YAML
52
55
apiVersion: apps/v1
@@ -112,6 +115,7 @@ Use the Kubernetes CLI, _kubectl_ , to connect to the Kubernetes cluster from yo
112
115
```bash
113
116
az aks install-cli
114
117
```
118
+
115
119
If you use Azure Cloud Shell, _kubectl_ is already installed, and you can skip this step.
116
120
117
121
### Connect to your AKS cluster
@@ -145,7 +149,7 @@ Run the following command to deploy the application instance to your AKS cluster
145
149
kubectl apply -f app_west.yaml
146
150
```
147
151
148
-
You will get a response indicating your deployment and service was created:
152
+
You get a response indicating your deployment and service was created:
Once the External-IP is available, open a web browser to the External-IP address of your service and you see the application running like below:
181
-
<screenshotforSeattle>
186
+
187
+
<!-- <screenshot for Seattle> -->
182
188
183
189
Run the same deployment steps and deploy an instance of the demo application to run in East US region.
184
190
@@ -189,10 +195,12 @@ kubectl get pods -n east
189
195
190
196
kubectl get service -n east
191
197
```
198
+
192
199
With two services opened in your browser, you should see that changing the inventory in one region is virtually instantly reflected in the other region. The inventory data is stored in the Redis Enterprise instances which are replicating data across regions.
193
200
194
-
You did it! Click on the buttons and explore the demo. To reset the count, add "/reset" after the url. e.g. <IPaddress>/reset
201
+
You did it! Click on the buttons and explore the demo. To reset the count, add `/reset` after the url:
195
202
203
+
`<IP address>/reset`
196
204
197
205
## Clean up your deployment
198
206
@@ -208,6 +216,7 @@ kubectl delete service shoppingcart-svc -n east
0 commit comments