Auto Backup for Database

This tutorial will give you an overview of how you can configure Stash auto-backup of the databases and the available configurable options for database auto-backup.

Configuring auto-backup for databases

To configure auto-backup for a database, you have to follow the following steps:

  • Create BackupBlueprint: At first, you have to create a BackupBlueprint with the template for Repository and BackupConfiguration. Use the appropriate Task in the task section.
  • Create Storage Secret: Then, you have to create a storage Secret in the same namespace as your database with the access credential to your backend. You can re-use this secret to backup the other databases in that namespace.
  • Add auto-backup annotations: Finally, add the auto-backup annotations to your database object or the respective AppBinding object.

Where to put auto-backup annotations

If you are using KubeDB to manage your databases, you can add the annotations to your database object. KubeDB will automatically pass those annotations to the respective AppBinding.

If you are not managing your database using KubeDB, you have to add the annotation in the respective AppBinding that you have created for your database.

Available Auto-Backup Annotations for Database

The following auto-backup annotations are available for the databases:

  • BackupBlueprint Name: You have to specify the BackupBlueprint name that holds the template for Repository and BackupConfiguration in the following annotation: <BackupBlueprint name>

You can also specify multiple BackupBlueprint name separated by comma (,). For example: daily-gcs-backup,weekly-s3-backup
  • Schedule: You can specify a custom schedule for a target to overwrite the schedule of the BackupBlueprint through this annotation. <Cron Expression>
  • Task Parameters: You can also pass some parameters to the respective backup Task through annotations. Use following format to pass parameters via annotations: value1 value2,value3 ab=123,bc=234

The above parameters will be added in the spec.task.params section as bellow,

  name: postgres-backup-13.1-v1
  - name: key1
    value: value1
  - name: key2
    value: value3,value3
  - name: key3
    value: ab=123,bc=234

Database Auto-backup Examples

You can find auto-backup examples for the databases here: