Import and Export data in Azure Redis Cache
Import/Export is an Azure Redis Cache data management operation, which allows you to import data into Azure Redis Cache or export data from Azure Redis Cache by importing and exporting a Redis Cache Database (RDB) snapshot from a premium cache to a blob in an Azure Storage Account.
- Export - you can export your Azure Redis Cache RDB snapshots to a Page Blob.
- Import - you can import your Redis Cache RDB snapshots from either a Page Blob or a Block Blob.
Import/Export enables you to migrate between different Azure Redis Cache instances or populate the cache with data before use.
This article provides a guide for importing and exporting data with Azure Redis Cache and provides the answers to commonly asked questions.
Import/Export is in preview and is only available for premium tier caches.
Import can be used to bring Redis compatible RDB files from any Redis server running in any cloud or environment, including Redis running on Linux, Windows, or any cloud provider such as Amazon Web Services and others. Importing data is an easy way to create a cache with pre-populated data. During the import process, Azure Redis Cache loads the RDB files from Azure storage into memory and then inserts the keys into the cache.
Before beginning the import operation, ensure that your Redis Database (RDB) file or files are uploaded into page or block blobs in Azure storage, in the same region and subscription as your Azure Redis Cache instance. For more information, see Get started with Azure Blob storage. If you exported your RDB file using the Azure Redis Cache Export feature, your RDB file is already stored in a page blob and is ready for importing.
To import one or more exported cache blobs, browse to your cache in the Azure portal and click Import data from the Resource menu.
Click Choose Blob(s) and select the storage account that contains the data to import.
Click the container that contains the data to import.
Select one or more blobs to import by clicking the area to the left of the blob name, and then click Select.
Click Import to begin the import process.
The cache is not accessible by cache clients during the import process, and any existing data in the cache is deleted.
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.
Export allows you to export the data stored in Azure Redis Cache to Redis compatible RDB file(s). You can use this feature to move data from one Azure Redis Cache instance to another or to another Redis server. During the export process, a temporary file is created on the VM that hosts the Azure Redis Cache server instance, and the file is uploaded to the designated storage account. When the export operation completes with either a status of success or failure, the temporary file is deleted.
To export the current contents of the cache to storage, browse to your cache in the Azure portal and click Export data from the Resource menu.
Click Choose Storage Container and select the desired storage account. The storage account must be in the same subscription and region as your cache.
Export works with page blobs, which are supported by both classic and Resource Manager storage accounts, but are not supported by Blob storage accounts at this time.
Choose the desired blob container and click Select. To use new a container, click Add Container to add it first and then select it from the list.
Type a Blob name prefix and click Export to start the export process. The blob name prefix is used to prefix the names of files generated by this export operation.
You can monitor the progress of the export operation by following the notifications from the Azure portal, or by viewing the events in the audit log.
Caches remain available for use during the export process.
This section contains frequently asked questions about the Import/Export feature.
- What pricing tiers can use Import/Export?
- Can I import data from any Redis server?
- What RDB versions can I import?
- Is my cache available during an Import/Export operation?
- Can I use Import/Export with Redis cluster?
- How does Import/Export work with a custom databases setting?
- How is Import/Export different from Redis persistence?
- Can I automate Import/Export using PowerShell, CLI, or other management clients?
- I received a timeout error during my Import/Export operation. What does it mean?
- I got an error when exporting my data to Azure Blob Storage. What happened?
What pricing tiers can use Import/Export?
Import/Export is available only in the premium pricing tier.
Can I import data from any Redis server?
Yes, in addition to importing data exported from Azure Redis Cache instances, you can import RDB files from any Redis server running in any cloud or environment, such as Linux, Windows, or cloud providers such as Amazon Web Services. To do this, upload the RDB file from the desired Redis server into a page or block blob in an Azure Storage Account, and then import it into your premium Azure Redis Cache instance. For example, you may want to export the data from your production cache and import it into a cache used as part of a staging environment for testing or migration.
To successfully import data exported from Redis servers other than Azure Redis Cache when using a page blob, the page blob size must be aligned on a 512 byte boundary. For sample code to perform any required byte padding, see Sample page blob upload.
What RDB versions can I import?
Azure Redis Cache supports RDB import up through RDB version 7.
Is my cache available during an Import/Export operation?
- Export - Caches remain available and you can continue to use your cache during an export operation.
- Import - Caches become unavailable when an import operation starts, and become available for use when the import operation completes.
Can I use Import/Export with Redis cluster?
Yes, and you can import/export between a clustered cache and a non-clustered cache. Since Redis cluster only supports database 0, any data in databases other than 0 isn't imported. When clustered cache data is imported, the keys are redistributed among the shards of the cluster.
How does Import/Export work with a custom databases setting?
Some pricing tiers have different databases limits, so there are some considerations when importing if you configured a custom value for the
databases setting during cache creation.
- When importing to a pricing tier with a lower
databaseslimit than the tier from which you exported:
- If you are using the default number of
databases, which is 16 for all pricing tiers, no data is lost.
- If you are using a custom number of
databasesthat falls within the limits for the tier to which you are importing, no data is lost.
- If your exported data contained data in a database that exceeds the limits of the new tier, the data from those higher databases is not imported.
- If you are using the default number of
How is Import/Export different from Redis persistence?
Azure Redis Cache persistence allows you to persist data stored in Redis to Azure Storage. When persistence is configured, Azure Redis Cache persists a snapshot of the Redis cache in a Redis binary format to disk based on a configurable backup frequency. If a catastrophic event occurs that disables both the primary and replica cache, the cache data is restored automatically using the most recent snapshot. For more information, see How to configure data persistence for a Premium Azure Redis Cache.
Import/ Export allows you to bring data into or export from Azure Redis Cache. It does not configure backup and restore using Redis persistence.
Can I automate Import/Export using PowerShell, CLI, or other management clients?
I received a timeout error during my Import/Export operation. What does it mean?
If you remain on the Import data or Export data blade for longer than 15 minutes before initiating the operation, you receive an error with an error message similar to the following example:
The request to import data into cache 'contoso55' failed with status 'error' and error 'One of the SAS URIs provided could not be used for the following reason: The SAS token end time (se) must be at least 1 hour from now and the start time (st), if given, must be at least 15 minutes in the past.
To resolve this, initiate the import or export operation before 15 minutes has elapsed.
I got an error when exporting my data to Azure Blob Storage. What happened?
Export works only with RDB files stored as page blobs. Other blob types are not currently supported, including blob storage accounts with hot and cool tiers. For more information, see Blob storage accounts.
Learn how to use more premium cache features.