Backup & Restore

Configuring Backups

Backups and snapshots are stored in a configurable backup directory. The backup directory should be on network attached storage, or periodically synced to a disk on another machine, to ensure that you can restore from your backup data during a hardware failure.

We recommend that you configure a backup directory on a disk with sufficient free space.

The the default backup directory is /var/opt/chef-automate/backups. If it does not exist it will be created during deployment.

To configure your Chef Automate installation’s backup directory to another location:

  1. Create a backup_config.toml file in your current directory with the following content, replacing /path/to/backups with the path to your backup directory:

    [global.v1.backups.filesystem]
      path = "/path/to/backups"
  2. Run the following command to apply your configuration:

    chef-automate config patch backup_config.toml

    Once this command is applied, the backup_config.toml file is no longer necessary, and can be removed.

Taking a Backup

You can take a backup with the following command:

chef-automate backup create

The command will show the backup progress for each service. If the backup is successful, you will see a success message and timestamp of the backup:

Success: Created backup 20180518010336

Listing Backups

You can list existing backups with the backup list command:

chef-automate backup list

The output will show each backup, and its age:

        Backup        State  Age
20180508201548    completed  8 minutes old
20180508201643    completed  8 minutes old
20180508201952    completed  4 minutes old

By default, this command communicates with your running Chef Automate installation to determine the backup directory. If the Chef Automate installation is down, you can still list the backups by passing your backup directory as an argument:

chef-automate backup list /var/opt/chef-automate/backups
Listing backups from local directory /var/opt/chef-automate/backups
        Backup        State  Age
20180508201548    completed  12 minutes old
20180508201643    completed  11 minutes old
20180508201952    completed  8 minutes old

Restoring backups

To restore a backup, mount the shared backup directory to the same mount point that was configured when the backup was created. If the backup directory is not network attached, copy the backup directory to the same location that was configured when the backup was created. The restore should be done on an instance that does not have Automate 2 installed on it.

If you have configured the backup directory to a directory that is not default (/var/opt/chef-automate/backups) you must supply the backup directory location with -b switch.

chef-automate backup restore BACKUP_ID -b /path/to/backups

To restore a backup of an airgapped installation, you must specify the Airgap Installation Bundle the installation is using:

chef-automate backup restore BACKUP_ID --airgap-bundle </path/to/bundle>

If the restore is successful, you will see the following message at the end of the status output:

Success: Restored backup 20180517223558

Deleting Backups

To delete backups from a running instance of Chef Automate, first find the relevant backup ID with chef-automate backup list and then delete it using chef automate backup delete ID.

chef-automate backup list
        Backup        State  Age
20181026183901    completed  1 minute old
20181026183954    completed  33 seconds old
20181026184012    completed  15 seconds old

You can delete a single backup with chef-automate backup delete:

chef-automate backup delete 20181026183901
The following backups will be permanently deleted:
20181026183901
Are you sure you want to continue? (y/n)
y
Success: Backups deleted

To delete multiple backups:

chef-automate backup delete 20181026183954 20181026184012
The following backups will be permanently deleted:
20181026183954
20181026184012
Are you sure you want to continue? (y/n)
y
Success: Backups deleted