Search code examples
backupazure-service-fabric

Service fabric backup, partition ID


If I have a statelful service fabric split into three partitions and want to backup to an external source, I can incorporate the partition ID of the service into the folder name of the external source containing the backup. When a restore is required the service instance can pass it's partition ID into the backup provider and so pull down the data for that particular partition.

My concern is that if there is a catastrophic failure and the service fabric needs to be rebuilt, the partitions will no longer have the same partition ID (it seems to be a Guid), in which case the restore process will not be able to find the backup for the new partition ID.

What is the recommended way to deal with this?

Instead of the PartitionID I am currently using the partition key, is this OK?


Solution

  • Yes that makes sense and you're doing it right. You can take a backup from one partition and restore it on a different partition in another service. The target service must use the same partition count and type.

    This way you can also use backup and restore to make a copy of an existing service, for debugging purposes for example.

    Code from this project can help you create and restore SF backups, and help you store the data in an external store.