A backup of a controller enables one to save (and later re-establish) the configuration and state of a controller. It does not influence workload instances on the backing cloud. That is, if such an instance is terminated directly in the cloud then a controller restore cannot re-create it.
This page will cover the following topics:
- Creating a backup
- Managing backups
- High availability considerations
There is a separate page that describes how to restore from a backup.
Data backups can also be made of the Juju client. See the Juju client page for guidance.
The Juju controller
Juju provides commands for recovering a controller in case of breakage or in the case where the controller no longer exists.
The current state is held within the ‘controller’ model. Therefore, all backup commands need to operate within that model explicitly or by ensuring the current model is the ‘controller’ model. In the examples provided below, both the controller name and the model name are expressed explicitly (e.g.
-m aws:controller). Due to the delicate nature of data backups, this method is highly recommended.
Creating a backup
create-backup command is used to create a backup. It does so by generating an archive and downloading it to the Juju client system as a ‘tar.gz’ file (a local backup). If the
--keep-copy option is used then a copy of the archive will also remain on the controller (a remote backup). With the aid of the
--no-download option a local backup can be prevented, but since the archive must be kept somewhere, this option implies
The name of the backup is composed of the creation time (in UTC) and a unique identifier.
The below examples assume the existence of the following controllers (output to
Controller Model User Access Cloud/Region Models Machines HA Version aws default admin superuser aws/us-east-1 2 1 none 2.3.7 lxd* default admin superuser localhost/localhost 2 1 none 2.3.7
To create a backup of the ‘aws’ controller:
juju create-backup -m aws:controller
20180515-191942.7e45250b-637a-4dc9-8389-c6aa70100cd6 downloading to juju-backup-20180515-191942.tar.gz
From the name of the archive we see that the backup was made on May 15, 2018 at 19:19:42 UTC.
Archive filenames do not include the associated controller name. Care should therefore be taken when archiving from multiple controllers. To specify a custom name use the
--filename option. This option does not affect the remote archive name.
To create a backup of the ‘lxd’ controller while both using a custom filename and adding an optional note:
juju create-backup -m lxd:controller --filename juju-backup-lxd-20180515-193724.tar.gz "fresh lxd controller"
The optional note is exposed via the
show-backup command detailed below.
A backup of a fresh (empty) environment, regardless of cloud type, is approximately 83 MiB in size.
The following commands are available for managing backups (apart from restoring):
backups command displays the names of all remote backups for a given controller. For instance, to see all remotely stored backups for the ‘lxd’ controller:
juju backups -m lxd:controller
show-backup command provides a metadata record for a specific remote backup (identified via the
backups command). For example, to query a backup stored on the ‘lxd’ controller:
juju show-backup -m lxd:controller 20180515-195557.9c6a3650-2957-489a-8f0c-6c3b5ce2e055
backup ID: "20180515-193724.9c6a3650-2957-489a-8f0c-6c3b5ce2e055" checksum: "pmxx7bCwtZVV+KM48YKz5w6Boc0=" checksum format: "SHA-1, base64 encoded" size (B): 58605244 stored: 2018-05-15 19:40:28 +0000 UTC started: 2018-05-15 19:37:24 +0000 UTC finished: 2018-05-15 19:37:41 +0000 UTC notes: "fresh lxd controller" model ID: "9c6a3650-2957-489a-8f0c-6c3b5ce2e055" machine ID: "0" created on host: "juju-e2e055-0" juju version: 2.3.7
started time is the most pertinent of the various timestamps. It refers to the time the backup was created.
download-backup command downloads a specific remote backup (again, identified via the
backups command). Here, we download a backup that is stored on the ‘aws’ controller:
juju download-backup -m aws:controller 20180515-191942.7e45250b-637a-4dc9-8389-c6aa70100cd6
upload-backup command uploads a specific local backup to a controller. For example:
juju upload-backup -m lxd:controller juju-backup-20180515-193724.tar.gz
It is not possible to upload a file that is equivalent to a backup stored remotely. The process will be cancelled and an error message will be printed.
remove-backup command removes a specific remote backup from a controller. For instance:
juju remove-backup -m aws:controller 20180515-191942.7e45250b-637a-4dc9-8389-c6aa70100cd6
To clean up any possible remote backups the
--keep-latest option can be used. This option instructs Juju to remove all remote backups with the exception of the most recently created one:
juju remove-backup -m aws:controller --keep-latest
Restoring from a backup
To revert the state of an environment to a previous time, use the stand-alone
juju restore-backup command was used, but as of Juju 2.9 that command is deprecated, and
juju-restore should be used instead.
High availability considerations
Although Controller high availability makes for a more robust (and load balanced) Juju infrastructure, it should not replace the need for data backups. It does, however, make the prospect of restoring from backup less likely, since as long as one controller cluster member remains operational, the others can be replaced via the
enable-ha command. A restore in an HA scenario therefore only becomes necessary when all controllers have failed. However, if a restore is applied to a cluster with active members all reachable controllers will naturally have their data overwritten.
Restoring due to complete cluster failure
In the advent that all controllers are unresponsive the following steps should be taken:
- Remove the controller
- Create a pristine controller
- Perform a data restore
- Enable HA
To demonstrate this, consider an initial AWS-based controller named ‘aws-ha3-1’ with three cluster members. The new controller will be called ‘aws-ha3-2’:
juju kill-controller aws-ha3-1 juju bootstrap aws aws-ha3-2 # use juju-restore to perform the data restore juju enable-ha -m aws-ha3-2:controller -n 3
Section Recovering from controller failure details how to deal with a partially degraded cluster.
Last updated 4 months ago.