Get the data out: migrate from Azure Cache for Redis to KiviDB
1. Make a storage account and a container. Premium exports page blobs, so it needs a general-purpose v2 account (not a Blob Storage account, not Data Lake…
Option 1: export an RDB (Premium, Enterprise, Azure Managed Redis)
1. Make a storage account and a container. Premium exports page blobs, so it needs a general-purpose v2 account (not a Blob Storage account, not Data Lake Gen2). Enterprise and Azure Managed Redis export block blobs. Enterprise and Azure Managed Redis cannot export to a storage account behind a firewall or a private endpoint; Premium can, with a managed identity (below).
az storage account create -n mymigration -g my-rg -l eastus --sku Standard_LRS --kind StorageV2
az storage container create --account-name mymigration -n kividb-move --auth-mode login
2. Make a SAS URL for the container with the permissions the export needs (read, add, create, write, delete, tag, move). Azure Managed Redis wants its end time at least an hour away:
SAS=$(az storage container generate-sas --account-name mymigration -n kividb-move \
--permissions racwdtm --expiry "$(date -u -d '+1 day' +%Y-%m-%dT%H:%MZ)" \
--auth-mode key --https-only -o tsv)
CONTAINER_URL="https://mymigration.blob.core.windows.net/kividb-move?$SAS"
3. Stop writes, if you want the file to be the final copy. The cache stays available during the export; anything written after it starts may not be in the file.
4. Export. In the portal, open the cache, Administration → Export data (on Azure Managed Redis, Export data in the resource menu), enter a blob name prefix, choose the container, and Export. Or:
# Premium
az redis export -n my-cache -g my-rg --prefix kividb-move --container "$CONTAINER_URL"
# Premium with a managed identity instead of a SAS (needed for a storage account with a firewall;
# grant the cache's identity Storage Blob Data Contributor on the account first)
az redis export -n my-cache -g my-rg --prefix kividb-move \
--container "https://mymigration.blob.core.windows.net/kividb-move" \
--preferred-data-archive-auth-method ManagedIdentity
# Enterprise, Enterprise Flash, Azure Managed Redis (the database is named "default")
az redisenterprise database export --cluster-name my-cache -g my-rg --sas-uri "$CONTAINER_URL"
PowerShell has Export-AzRedisCache and, for Enterprise and Azure Managed
Redis, Export-AzRedisEnterpriseCache.
5. Download and unpack the files. A clustered cache can write several blobs. List the container to see what you got:
az storage blob list --account-name mymigration -c kividb-move --auth-mode login -o table
az storage blob download-batch --account-name mymigration -s kividb-move -d ./backup --auth-mode login
gunzip ./backup/*.gz 2>/dev/null
for f in ./backup/*; do printf '%s: ' "$f"; head -c 9 "$f"; echo; done
Each file that starts with REDIS00 is an RDB that KiviDB reads.
Option 2: copy over normal commands (every tier)
This is the only way out of Basic and Standard, and it can keep following changes while you prepare the switch. Microsoft's own migration guidance names the same approach.
Run the copy on a VM that can reach both the cache and KiviDB: in the cache's virtual network (Premium VNet injection, or a private endpoint), or with the VM's address on the cache's firewall rules (Basic to Premium). Azure Managed Redis has no IP firewall: use public access or a private endpoint.
- RedisShake (open source, MIT) in scan mode copies each key with
DUMPandRESTORE, and with keyspace notifications keeps copying keys as they change. - RIOT (open source, Apache 2.0) with
--structreads and writes each type with its own commands. It is the one that carries time series across.
Following changes. Turn on keyspace notifications for the copy, with the
value KEA:
- Standard and Premium: Advanced settings → Keyspace notifications. Basic does not offer them, so on Basic stop writes before the copy.
- Azure Managed Redis: Advanced settings → Keyspace notification (in
preview), or the database's
notifyKeyspaceEventsproperty.
Install RedisShake:
curl -LO https://github.com/tair-opensource/RedisShake/releases/download/v4.7.0/redis-shake-v4.7.0-linux-amd64.tar.gz
tar xzf redis-shake-v4.7.0-linux-amd64.tar.gz
# Basic, Standard, Premium without clustering
[scan_reader]
address = "my-cache.redis.cache.windows.net:6380"
password = "ACCESS_KEY"
tls = true
ksn = true
count = 100
# Premium with clustering, or the OSS cluster policy
[scan_reader]
cluster = true
address = "my-cache.redis.cache.windows.net:6380" # Enterprise / Azure Managed Redis: my-cache.eastus.redis.azure.net:10000
password = "ACCESS_KEY"
tls = true
ksn = true
count = 100
# Enterprise cluster policy or Non-clustered: one endpoint answers for every shard
[scan_reader]
address = "my-cache.eastus.redis.azure.net:10000"
password = "ACCESS_KEY"
tls = true
ksn = true
count = 100
skip_unknown_type = ["TSDB-TYPE", "MBbloom--", "MBbloomCF", "CMSk-TYPE", "TopK-TYPE", "TDIS-TYPE"]
skip_unknown_type leaves out the module types KiviDB cannot take as a DUMP
payload; time series then go across with RIOT (below). The [redis_writer]
part is in Load it into KiviDB. DUMP costs the cache
CPU: start with a low count and watch Server Load.