|
| 1 | +--- |
| 2 | +id: backup |
| 3 | +title: Backup Resources |
| 4 | +--- |
| 5 | + |
| 6 | +Backup is a common prerequisite step to be done before re-running or modifying a resource. Currently, Optimus supports |
| 7 | +backup for BigQuery tables and provides dependency resolution, so backup can be also done to all the downstream tables |
| 8 | +as long as it is registered in Optimus and within the same project. |
| 9 | + |
| 10 | +## Configuring backup details |
| 11 | + |
| 12 | +Several configurations can be set to have the backup result in your project as your preference. Here are the |
| 13 | +available configurations for BigQuery datastore. |
| 14 | + |
| 15 | +Configuration key | Description | Default | |
| 16 | +------------------|------------------------------------------|----------------| |
| 17 | +ttl | Time to live in duration | 720h | |
| 18 | +prefix | Prefix of the result table name | backup | |
| 19 | +dataset | Where the table result should be located | optimus_backup | |
| 20 | + |
| 21 | +These values can be set in the project [configuration](../getting-started/configuration.md). |
| 22 | + |
| 23 | + |
| 24 | +## Run a backup |
| 25 | + |
| 26 | +To start a backup, run the following command: |
| 27 | + |
| 28 | +```shell |
| 29 | +$ optimus backup resource --project sample-project --namespace sample-namespace |
| 30 | +``` |
| 31 | + |
| 32 | +After you run the command, prompts will be shown. You will need to answer the questions. |
| 33 | + |
| 34 | +``` |
| 35 | +$ optimus backup resource --project sample-project --namespace sample-namespace |
| 36 | +? Select supported datastore? bigquery |
| 37 | +? Why is this backup needed? backfill due to business logic change |
| 38 | +? Backup downstream? Yes |
| 39 | +``` |
| 40 | + |
| 41 | +You will be shown a list of resources that will be backed up, including the downstream resources (if you chose to do so). |
| 42 | +You can confirm to proceed if the list is as expected, and please wait until the backup is finished. |
| 43 | + |
| 44 | +Once the backup is finished, the list of backup results along with where it is located will be shown. |
| 45 | + |
| 46 | + |
| 47 | +## Get list of backups |
| 48 | + |
| 49 | +List of recent backups of a project can be checked using this sub command: |
| 50 | + |
| 51 | +```shell |
| 52 | +$ optimus backup list --project sample-project |
| 53 | +``` |
| 54 | + |
| 55 | +Recent backup ID including the resource, when it was created, what is the description or purpose of the backup will be |
| 56 | +shown. Backup ID is used as a postfix in backup result name, thus you can find those results in the datastore |
| 57 | +(for example BigQuery) using the backup ID. However, keep in mind that these backup results have expiry time set. |
| 58 | + |
| 59 | +## Run a backup dry run |
| 60 | + |
| 61 | +A dry run is also available to simulate all the resources that can be backed up without actually doing it. Example of dry |
| 62 | +run usage: |
| 63 | + |
| 64 | +```shell |
| 65 | +$ optimus backup resource --project sample-project --namespace sample-namespace --dry-run |
| 66 | +``` |
0 commit comments