You are looking at the documentation of a prior release. To read the documentation of the latest release, please
visit here.
Batch Backup and Restore Overview
Sometimes, an application may consist of multiple co-related components. For example, to deploy a WordPress, you will need a Deployment for the WordPress and another Deployment for the database. Now, it is sensible to want to backup or restore both of the deployments using a single configuration as they are parts of the same application.
Stash 0.9.0+ supports taking backup multiple co-related components using a single configuration known as BackupBatch. Stash 0.10.0+ supports restoring multiple co-related components together known as RestoreBatch This guide will give you an overview of how batch backup and restore works in Stash.
How Batch Backup Works
The following diagram shows how Stash takes backup of multiple co-related components in a single application. Open the image in a new tab to see the enlarged version.
The backup process consists of the following steps:
- At first, a user creates a backend Secret. This secret holds the credentials to access the backend where the backed up data will be stored. 
- Then, she creates a - Repositorycrd which represents the original repository in the backend.
- Then, she creates a - BackupBatchcrd which specifies multiple targets(workload, volume, and database). It also specifies the- Repositoryobject that holds the backend information where the backed up data will be stored.
- Stash operator watches for - BackupBatchobjects.
- When it finds a - BackupBatchobject, it checks if there is any workload as a target. If there any, it injects a sidecar named- stashinto the workloads.
- It also creates a - CronJobto trigger backups periodically.
- The - CronJobtriggers backup on each scheduled slot by creating a- BackupSessioncrd.
- The BackupSession controller (inside sidecar for sidecar model or inside the operator itself for job model) watches for - BackupSessioncrd.
- When it finds a - BackupSessionit starts the backup process immediately(for job model a job is created for taking backup) for the individual targets. Stash operator enforces the backup order if the- executionOrderis set to- Sequential.
- The individual targets complete their backup process independently and update their respective fields in - BackupSessionstatus.
How Batch Restore Works
The following diagram shows the batch restore process. Please, open image in new tab to view the enlarged image.
The batch restore process consists of the following steps:
- At first, the user creates a RestoreBatchCR specifying the targets and the respective Repository where the backed up data has been stored.
- The Stash operator watches for the RestoreBatchCR.
- When the Stash operator finds a RestoreBatchCR, it executes the globalPreRestorehooks. If there is no globalPreRestorehook, Stash will skip this step.
- Then, it injects an init-container into the target that follows the sidecar model and creates a restore job for the targets that follow the job model. Stash operator enforces the restore order in this step if the executionOrderis set toSequential.
- The restore init-container/job first execute their local PreRestorehooks. Then, restore their data and finally execute theirPostRestorehooks.
- Finally, Stash operator executes the global PostRestorehooks. If there is not globalPostRestorehook configured for this RestoreBatch, Stash will skip this step.
Next Steps
- See a step by step guide to backup application with multiple co-related components here.







