question

MichaBorkowski-6575 avatar image
0 Votes"
MichaBorkowski-6575 asked GeethaThatipatri-MSFT rolled back

Redis Persistence on Azure not working

Hello.

Please consider this Bicep template:

 param deploymentName string = ''
    
 resource storageAccountsRedis 'Microsoft.Storage/storageAccounts@2021-04-01' = {
   name: '${deploymentName}redis'
   location: resourceGroup().location
   sku: {
     name: 'Standard_GRS'
   }
   kind: 'BlobStorage'
   properties: {
     accessTier: 'Cool'
     allowSharedKeyAccess: true
   }
 }
    
 resource redisDatabase 'Microsoft.Cache/redis@2020-12-01' = {
   dependsOn: [
     storageAccountsRedis
   ]
   name: '${deploymentName}Redis'
   location: resourceGroup().location
   properties: {
     enableNonSslPort: true
     redisConfiguration: {
       'rdb-backup-enabled': 'true'
       'rdb-backup-frequency': '15'
       'rdb-backup-max-snapshot-count': '1'
       'rdb-storage-connection-string': 'DefaultEndpointsProtocol=https;BlobEndpoint=https://${storageAccountsRedis.name}.blob.${environment().suffixes.storage};AccountName=${storageAccountsRedis.name};AccountKey=${storageAccountsRedis.listKeys().keys[0].value}'
     }
     redisVersion: '6'
     sku: {
       capacity: 1
       family: 'P'
       name: 'Premium'
     }
   }
 }

This is a very simple template that deploys Redis, with a backup to Storage Account every 15 minutes. When I deploy it a container -persistence is created in the Storage Account, but no backups ever appear in it. I can't find any errors/warnings regarding backups.

I don't know how should I proceed from here.




azure-cache-redis
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

1 Answer

GeethaThatipatri-MSFT avatar image
0 Votes"
GeethaThatipatri-MSFT answered GeethaThatipatri-MSFT rolled back

Hi, @MichaBorkowski-6575 Welcome to the Microsoft Q&A Platform, and thanks for your query.
As we understand you are trying to deploy a sample template to Redis and you are facing an issue as -persistence is created in the storage account.
By seeing the code which you have shared180780-image.png is not supported, The Redis cache persist file is "Page blob" The account type "BlobStorage" does not support page blob.
Change it to StorageV2 and give it a try.
Regards
Geetha



image.png (1.3 KiB)
· 8
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

Hi, @MichaBorkowski-6575 We haven't heard back from you. Just wanted to check if you are still facing the issue? did you get a chance to try the above-mentioned changes?

Regards
Geetha

0 Votes 0 ·
MichaBorkowski-6575 avatar image MichaBorkowski-6575 GeethaThatipatri-MSFT ·

Thank you for help. I did not answer earlier because for some reason I did not get an email about your answer.

After changing kind: 'BlobStorage' to kind: 'StorageV2' the backup indeed started to work. In the storage account I see two files: one file is 1KB of size, the other 0B.

Unfortunately, when trying to restore the backup, Redis reported that the 1KB file isn't a valid RDB file. I tried removing the initial 512 bytes of the file, and then the backup has correctly restored.

What is the correct procedure for restoring backups?

0 Votes 0 ·

And a follow-up question: in my case I used a very small Redis database for testing. When the database is bigger, will I also see two files: one with all the data, and the other one empty?

0 Votes 0 ·

Hi, @MichaBorkowski-6575 Thanks for your response, good to hear that it worked for you.
Sure let me check on backup restore and provide you with more details.

Regards
Geetha


0 Votes 0 ·
Show more comments