Backing up and restoring PE
Keep regular backups of your Puppet Enterprise (PE) infrastructure. Backups allow you to more easily migrate to new primary server hardware, migrate your PE installation after a major OS upgrade, troubleshoot your installation, and quickly recover from system failures.
This information is intended for standard installations without disaster recovery. While you can backup large and extra-large installations, you might not be able to perform a complete recovery. For large and extra-large installations, consider Disaster recovery or alternative backup or snapshot options.
If your installation includes disaster recovery, you must Restore your infrastructure before provisioning a new replica.
You can use the puppet-backup
command to back up and
restore your primary server. You can't use this command to back up compilers.
The puppet-backup
command does not backup or restore
secret keys. You must backup and restore these separately and securely.
Customizing backup and restore scope
By default, the PE backup and restore commands include
your PE configuration, PE
certificates, Puppet code, and PuppetDB. However, you can use the --scope
option to customize which data is backed up or restored.
puppet-backup
command backs up (or
restores) the following data:- Your PE configuration, including license, classification, and RBAC settings. However, the configuration backup data does not include Puppet gems or Puppet Server gems.
- PE CA certificates and the full SSL directory.
- The Puppet code deployed to your code directory at the time of the backup.
- PuppetDB data, including facts, catalogs and historical reports.
puppet-backup
command does not
include secret keys. You must back up this data separately and securely.If you want to have discrete backup files, or if you want to back up some parts of your
infrastructure more often than others, you can use --scope
command line option to limit the scope of a backup or restore. The
--scope
option accepts one or more of certs
, code
, config
, or puppetdb
. If
unspecified, the default value is all
. For details about
what is and isn't included in each scope, refer to Directories and data in backups.
For example, if you have frequent code changes, you might back up your Puppet code more often than you back up the rest of your infrastructure. When you limit the backup scope, the backup file contains only the parts of your infrastructure that you specify. Be sure to identify the scope in your backup file's name so you know what each file contains.
In PE 2023.0 and 2021.0 - 2021.7.2, backup operations
with a scope of certs
might fail to back up the
certificate authority (CA) root key and certificates because of a change in the
default CA directory (cadir
). If the CA root key and
certificates are not backed up, run a full backup without specifying a scope.
Similarly, if you run the puppet-backup restore
command with a scope of certs
, the restore operation
might fail. As a workaround, run a full restore operation.
This workaround is necessary because the CA default directory (cadir
) was changed starting with Puppet
7, but the update was not immediately implemented in the puppet-backup create
and puppet-backup
restore
commands. For more information about the directory change, see
New CA directory location. The directory
location is documented in cadir.
When you restore your primary server, you must restore your Puppet configuration, certificates, code, and PuppetDB data. However, you can restore each aspect from
different files, either by using backup files that have limited scopes or by limiting
the restore scope. For example, by limiting the scope when you run the puppet-backup restore
command, you could restore Puppet code, configuration, and certificates from one
backup file, and then restore PuppetDB from a different
backup file.
puppet-backup restore
command multiple times,
restoring a different file each time, until you have restored all four data sets
(configuration, certificates, code, and PuppetDB).Back up your infrastructure
The Puppet Enterprise (PE) backup process creates a copy of your primary server, including configuration, certificates, code, and PuppetDB. Backup can take several hours depending on the size of PuppetDB.
puppet-backup
command to backup
your PE configuration, PE
certificates, Puppet code, and PuppetDB data. For details about the data included in backup
files, refer to Customizing backup and restore scope.puppet-backup
to create a new backup,
PE creates a single backup file containing everything
you're backing up (defined by the --scope
). PE writes backup files to /var/puppetlabs/backups
, unless you specify a different location in the
puppet-backup
command. The file name follows the
default naming convention (pe_backup-<TIMESTAMP>.tgz
), unless you specified a different name in
the puppet-backup
command.puppet-backup
command does not backup secret keys.
You must back up these separately.Restore your infrastructure
Use the Puppet Enterprise (PE) restore process to migrate your primary server to a new host or to recover from system failure.
You must have created backup files, as described in Back up your infrastructure.
To decrypt an encrypted backup, you must import the GPG key pair (both the public and private keys) that you used for encryption to your new primary server.
pg_repack
doesn't run
prior to or during the restore process.Directories and data in backups
These directories and data are included in PE backups.
A default puppet-backup
command captures all scopes,
meaning all directories and data described in the table below. However, you can use the
--scope
option to limit the contents of backup files,
or to restore data from multiple backup files, as described in Customizing backup and restore scope. In this case, the --scope
option indicates which directories and data to back up or
restore.
Scope | Directories and databases |
---|---|
certs (PE
certificates) |
|
code (Puppet
code) |
This scope captures the Puppet code deployed
to your code directory at the time of the backup. Specifically:
|
config (PE
configuration) |
This scope captures your PE configuration,
including license, classification, and RBAC settings. Some directories and data
are excluded, such as Puppet gems, Puppet Server gems, and directories captured in other
scopes. Specifically, it includes:
|
puppetdb (PuppetDB) |
|