Skip to content

Commit 5641cb3

Browse files
committed
Add guide to migrate Redis to Valkey
1 parent 1e8f0af commit 5641cb3

File tree

1 file changed

+50
-0
lines changed

1 file changed

+50
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
---
2+
tags: [valkey, redis, how-to, migrate]
3+
---
4+
5+
# Migrate to Valkey
6+
7+
If you need to keep the data and your application needs to be available during the migration, reach out to the nais team for assistance.
8+
9+
## Prerequisites
10+
11+
- Your app uses Redis for a simple caching store and can handle the data missing at startup.
12+
13+
## Variants
14+
15+
The steps to migrate differ depending on how your Redis instance has been created:
16+
17+
1. You created the Redis instance implicitly by adding a `redis` block to your application manifest.
18+
2. You created the Redis instance explicitly by creating a `Redis` resource.
19+
20+
### Implicit Redis instance
21+
22+
If you created the Redis instance implicitly by adding a `redis` block to your application manifest, follow these steps:
23+
24+
1. Copy the `redis` block in your application manifest to use `valkey` instead. The fields are the same.
25+
2. Deploy the updated application manifest.
26+
27+
Your application is now using Valkey instead of Redis.
28+
3. Prepare Redis for deletion:
29+
30+
`kubectl patch redis redis-<TEAM-NAME>-<INSTANCE-NAME> --type json -p='[{"op": "replace", "path": "/spec/terminationProtection", "value": false}]'`
31+
32+
4. Remove the `redis` block from your application manifest and deploy the updated manifest.
33+
34+
The Redis instance will now be deleted.
35+
5. Congrats! Your application now uses Valkey instead of Redis.
36+
37+
### Explicit Redis instance
38+
39+
If you created the Redis instance explicitly by creating a `Redis` resource, follow these steps:
40+
41+
1. Make a copy of your Redis manifest to hold your Valkey manifest.
42+
2. Update `kind` from `Redis` to `Valkey`.
43+
3. Change the name from `redis-<TEAM-NAME>-<INSTANCE-NAME>` to `valkey-<TEAM-NAME>-<INSTANCE-NAME>`.
44+
4. Deploy the manifest.
45+
5. For each application that uses this Redis instance:
46+
1. Change the `redis` block in the application manifest to use `valkey` instead. The fields are the same.
47+
2. Deploy the updated application manifest.
48+
6. Delete the Redis manifest from source control so it doesn't get recreated.
49+
7. Delete the old Redis instance: `kubectl delete redis redis-<TEAM-NAME>-<INSTANCE-NAME>`.
50+
8. Congrats! Your application now uses Valkey instead of Redis.

0 commit comments

Comments
 (0)