8. Backup and Restore Applications¶
ROBIN Storage allows one to:
Backup Apps+Data to an external storage repository such as S3 Object Store, Google Cloud Storage, etc.
Make Apps+Data portable across Kubernetes clusters spanning on-prem, publc and hybrid cloud environments.
Add backup summary
Topics covered in this chapter:
|
Backup an application snapshot to repository |
|
Delete backup of an application snapshot |
|
List all backups of an application |
|
Show information about a specific backup |
|
Show transfer status of backup to repository |
|
Share a backup with one or more users |
|
Stop sharing a backup with one or more users |
|
Generate a token for use when importing an application backup into another cluster |
|
Import an application backup from another cluster |
8.1. Create App Backup¶
A backup of a snapshot can be created using the following command:
$ robin backup create <name> <snapshotid> <reponame>
|
Name to assign to the backup created from the specified snapshot
|
|
Unique ID of the snapshot (obtained from the output of
robin snapshot list ) |
|
Name of the repo where you the backup will be pushed
|
Example:
$ robin backup create backup-init 39f292f85a6611e99bbdb91ac50a0916 datadump
Use the ``robin backup list`` command to verify the backup has been succesfully created and pushed to an external repo.
$ robin backup list
+----------------------------------+--------------+--------------------+--------+
| Backup ID | Backup Name | Snapshot Name | State |
+----------------------------------+--------------+--------------------+--------+
| a722a81e5a6811e9befabdcd54699900 | backup-mysql | mysql-1_snap-mysql | Pushed |
| ebc453b45a6611e99876835407ddf3c4 | backup-init | mydb_snap-init | Pushed |
+----------------------------------+--------------+--------------------+--------+
Note
The ability to create a backup is subject to ROBIN Role Based Access Control (RBAC). By default, all Cluster Users (users having the clusteruser role) have permission to create backups, provided they can access the underlying App snapshot. Cluster Administrators (users having the clusteradmin role) have permission to create backups from all App snapshots. See the section on User Management for details on how ROBIN RBAC works.
Before creating a backup, the underlying App must have been attached to the target repo.
8.2. Delete App Backup¶
An Application backup can be deleted using the following command:
$ robin backup delete <backupid> [--repo-purge] [--catalog-purge] [--force]
|
Unique ID of the backup (obtained from the output of
robin backup list ) |
|
Purge the backup from repo catalog and external repo
|
|
Purge backup from the repo catalog only
|
|
Force removal of an application backup from the storage repo catalog and storage repo (required when the
--repo-purge option is specified). |
Following are a number of examples showing the various backup delete scenarios. Except when including the --repo-purge
option, use the robin backup list
command to verify the status of the backup after the completion of the delete operation.
Example 1: Delete the local copy of a backup:
$ robin backup delete ebc453b45a6611e99876835407ddf3c4
$ robin backup list
+----------------------------------+--------------+--------------------+-----------------+
| Backup ID | Backup Name | Snapshot Name | State |
+----------------------------------+--------------+--------------------+-----------------+
| ebc453b45a6611e99876835407ddf3c4 | backup-mysql | mysql-1_snap-mysql | Deleted Locally |
+----------------------------------+--------------+--------------------+-----------------+
Example 2: Delete the local copy of a backup and purge it fro the repo catalog:
Delete the local copy of a backup, but leave it in the repo catalog:
$ robin backup delete ebc453b45a6611e99876835407ddf3c4 --catalog-purge
$ robin backup list
+----------------------------------+--------------+--------------------+-----------------+
| Backup ID | Backup Name | Snapshot Name | State |
+----------------------------------+--------------+--------------------+-----------------+
+----------------------------------+--------------+--------------------+-----------------+
Example 3: Delete the local copy of a backup and purge it fro the repo catalog and external repo:
$ robin backup delete ebc453b45a6611e99876835407ddf3c4 --repo-purge
There is no way to verify that the backup remains in the external repo since it was purged from
the repo catalog.
Note
The ability to delete a backup is subject to ROBIN Role Based Access Control (RBAC). By default, all Cluster Users (users having the clusteruser role) have permission to delete from local storage any backups they have created. They do not have permission, however, to purge backups from the repo. Cluster Administrators (users having the clusteradmin role), on the other hand, have permission to delete all backups as well as purge backups from a repo catalog and the external repo.
All backups that have been pushed to a repo (which is to say, all backups), can be viewd using the robin backup list
command. The robin repo contents
command also provides informaton about backups that have been pushed to a repo. This command, however, can only be invoked by Cluster Administrators (users having the clusteradmin role).
8.3. List App Backups¶
Backups for snapshots are listed using the following command:
$ robin backup list [--app <appname>]
|
Only show backups for the specified application are displayed
|
|
Provide additional informatoin about each backup
|
|
Same output as the
--wide option, plus include which users the backup has been shared with |
Example 1: List backups of a specific app:
$ robin backup list --app mydb
+----------------------------------+-------------+----------------+--------+
| Backup ID | Backup Name | Snapshot Name | State |
+----------------------------------+-------------+----------------+--------+
| ebc453b45a6611e99876835407ddf3c4 | backup-init | mydb_snap-init | Pushed |
+----------------------------------+-------------+----------------+--------+
Example 2: List all backups:
$ robin backup list
+----------------------------------+--------------+--------------------+--------+
| Backup ID | Backup Name | Snapshot Name | State |
+----------------------------------+--------------+--------------------+--------+
| ebc453b45a6611e99876835407ddf3c4 | backup-init | mydb_snap-init | Pushed |
| a722a81e5a6811e9befabdcd54699900 | backup-mysql | mysql-1_snap-mysql | Pushed |
+----------------------------------+--------------+--------------------+--------+
Note
The ability to view backups is subject to ROBIN Role Based Access Control (RBAC). By default, Cluster Users (users having the clusteruser role) are able to view all backups they have created, pluss any that have been shared with them (see Share App Backup for details). See the section on User Management for details on how ROBIN RBAC works.
8.4. Get Information About a Specific App Backup¶
Details of a specific backup can be obtained using the following command:
$ robin backup info <backupid>
|
Unique ID of the backup (obtained from the output of
robin backup list ) |
Example:
$ robin backup info ebc453b45a6611e99876835407ddf3c4
Name : backup-init
Id : ebc453b45a6611e99876835407ddf3c4
Snapshot Name : mydb_snap-init
Application Name : mydb
Application Kind : helm
State : Pushed
Repo : datadump
Description : -
Start Time : 08 Apr 2019 18:29:30
End Time : 08 Apr 2019 18:29:37
Trigger Details
-------
Operation : MANUAL
User : robin
Tenant : Administrators
Data Details
-------
Transferred : 96.0 MB
Skipped : 0.0 MB
Total : 96.0 MB
Time Taken : 7s
Note
The ability to view information about a backup is subject to ROBIN Role Based Access Control (RBAC). By default, Cluster Users (users having the clusteruser role) are able to view info for all backups they have created, pluss any that have been shared with them (see Share App Backup for details). See the section on User Management for details on how ROBIN RBAC works.
Information about the local application will only be included in the output if the applicaton still exists. This information will never be displayed for backups which are imported from another ROBIN cluster.
8.5. Monitor Status of App Backup¶
The status of transfers of backups to their respective repositories can be viewed using the following command:
$ robin backup status
Example:
$ robin backup status
+-------------+----------------------------------+-----------------+
| Name | TransferStatus | Schedule/Manual |
+-------------+----------------------------------+-----------------+
| backup-init | 9% [###.................] 96.0MB | MANUAL |
+-------------+----------------------------------+-----------------+
After a few seconds. We can run the command again to see:
$ robin backup status
+-------------+----------------------------------+-----------------+
| Name | TransferStatus | Schedule/Manual |
+-------------+----------------------------------+-----------------+
| backup-init | 100% [##################] 96.0MB | MANUAL |
+-------------+----------------------------------+-----------------+
8.8. Export App Backup¶
Generate a token for use when importing an application backup into another cluster:
$ robin backup export <backupid>
|
Application backup ID
|
Example:
$ robin backup list
+----------------------------------+-------------+----------+--------------------+--------+
| Backup ID | Backup Name | Repo | Snapshot Name | State |
+----------------------------------+-------------+----------+--------------------+--------+
| 644770427d8911e9b908cbe6a78db423 | mysql1 | testrepo | mysql1_mysql1-snap | Pushed |
+----------------------------------+-------------+----------+--------------------+--------+
$ robin backup export 644770427d8911e9b908cbe6a78db423
eyJyZXBvX3R5cGUiOiAiR0NTIiwgImJhY2t1cF9pZCI6ICI2NDQ3NzA0MjdkODkxMWU5YjkwOGNiZTZhNzhkYjQyMyIsICJiYWNrdXBfcGF0aCI6ICJkZXYvdGVzdGluZy9hcHBjb25maWcvMTU1ODU5NDE0Ny9teXNxbDFfMS9teXNxbDFfbXlzcWwxLXNuYXAuanNvbiIsICJyZXBvX3BhcmFtcyI6IHsiYnVja2V0IjogInRlc3RidWNrZXQtMTAyOTM4NDc1NiIsICJyZXBvX3R5cGUiOiAiR0NTIiwgInBhdGgiOiAiZGV2L3Rlc3RpbmcvIiwgImNyZWRlbnRpYWxzIjogeyJwcm9qZWN0X2lkIjogInJvY2stcmFuZ2UtMjA3NjIyIn19fQ==
Note
The ability to export a backup is subject to ROBIN Role Based Access Control (RBAC). By default, only Cluster Administrators (users having the clusteradmin role) have permission to do so. See the section on User Management for details on how ROBIN RBAC works.
8.9. Import App Backup¶
Import an application backup from another cluster:
$ robin backup import <backup_token>
|
Token containing details of the backup to import
|
Example:
$ robin backup import eyJyZXBvX3R5cGUiOiAiR0NTIiwgImJhY2t1cF9pZCI6ICI2NDQ3NzA0MjdkODkxMWU5YjkwOGNiZTZhNzhkYjQyMyIsICJiYWNrdXBfcGF0aCI6ICJkZXYvdGVzdGluZy9hcHBjb25maWcvMTU1ODU5NDE0Ny9teXNxbDFfMS9teXNxbDFfbXlzcWwxLXNuYXAuanNvbiIsICJyZXBvX3BhcmFtcyI6IHsiYnVja2V0IjogInRlc3RidWNrZXQtMTAyOTM4NDc1NiIsICJyZXBvX3R5cGUiOiAiR0NTIiwgInBhdGgiOiAiZGV2L3Rlc3RpbmcvIiwgImNyZWRlbnRpYWxzIjogeyJwcm9qZWN0X2lkIjogInJvY2stcmFuZ2UtMjA3NjIyIn19fQ==
Note
The ability to import a backup is subject to ROBIN Role Based Access Control (RBAC). By default, only Cluster Administrators (users having the clusteradmin role) have permission to do so. See the section on User Management for details on how ROBIN RBAC works.