Backup Essentials
The short version of backup and restore for an Embedded Cluster install. Set up disaster recovery backups once, check them, and restore on a new host.
Embedded Cluster only
This page is the short version for an Embedded Cluster install. It has the steps and the facts that you need, and no more. The full procedures, the reasons, and the troubleshooting are on two other pages:
- Backup and Restore in Depth: every check and every edge case, and manual backups.
- PostgreSQL Backups and Disaster Recovery: the reference and the troubleshooting.
For a Helm install, see Backups (Helm).
NetBox Enterprise makes two kinds of backup:
| Kind | What it holds | Where it goes | On by default? |
|---|---|---|---|
| PostgreSQL backup | Your database | A volume inside the cluster | Yes |
| Disaster recovery backup | The whole install, which includes the PostgreSQL backups | Your S3 bucket, outside the cluster | No |
A PostgreSQL backup alone does not protect you against the loss of the host, because it stays in the cluster. You need both. Your only task is to set up the disaster recovery backups.
1. Set up disaster recovery backups
Do these steps once.
- In the admin console, open Disaster Recovery, and then click Backup settings.
- Enter your S3 bucket, credentials, endpoint, and region. If you have more than one NetBox Enterprise cluster, give each one its own Prefix.
- Click Update storage settings.
- Click the Settings & Schedule tab, select Enable scheduled backups, pick Daily or Weekly, and then click Update schedule.
- Click the Backups tab, and then click Start a backup. Wait for it to show Completed.
- Write down one number from your NetBox, such as the count on the Sites page. You compare it after a disaster recovery restore.
The schedule sets how much work you can lose. A daily schedule can lose up to one day of changes.
Each disaster recovery backup is kept for one month by default. The Retention policy card on the Settings & Schedule tab changes that.
2. Check that both kinds of backup work
Do this check after the setup, and again after each upgrade.
-
In the admin console, open Disaster Recovery, and then click the Backups tab. The newest disaster recovery backup must show Completed.
-
On the host, confirm that a PostgreSQL backup ran:
kubectl -n kotsadm exec -it \ "$(kubectl -n kotsadm get pod \ -l postgres-operator.crunchydata.com/pgbackrest-dedicated= \ -o name | head -1)" \ -c pgbackrest -- pgbackrest info --stanza=dbThe output must list at least one
full backupwith a recent timestamp.No stanzas exist in the repository.means that no PostgreSQL backup ran yet. The first one runs on the next schedule time, which is 01:00 by default.
If one of the checks fails, see Verify that both kinds of backup work.
3. Restore on a new host
Use these steps when you lost the host, or when you want to test a disaster recovery restore.
- Start with a host that has no cluster. To reuse the same host, run
sudo ./netbox-enterprise reset --yesfirst. The host reboots, so connect again when it is up. - Download the installer for the NetBox Enterprise version that ran when the disaster recovery backup was made. The restore prompt shows only the disaster recovery backups that match the installer.
- Run
sudo ./netbox-enterprise restore, and enter the S3 settings from step 1. - When the installer shows the name of a disaster recovery backup, confirm that it is the one you expect, and then enter
Y. - When the installer asks, enter
continue. After a few minutes it shows Application restored! - Wait a few more minutes. Log in to NetBox, open the Sites page, and compare the count with the number you wrote down.
If NetBox shows no data, or PostgreSQL does not start, the PostgreSQL restore did not complete. See Disaster recovery restore procedure.
For a disaster recovery restore that adds nodes, see High-availability restore.
Four facts you must know
- Use the matching installer. The restore prompt hides each disaster recovery backup that does not match the installer version, and it shows no message. See Confirm the installer matches your newest disaster recovery backup.
- A disaster recovery backup from before 2.3.0 has no database. After you upgrade from an earlier release, take a PostgreSQL backup on demand, and then take a disaster recovery backup. Do not use the older ones. See Upgrades.
- A running cluster does not prove that your data came back. Only the number from step 6 does. See Verify.
- Do not turn off PostgreSQL backups. Without them, a disaster recovery backup has no database. See With PostgreSQL backups off, nothing backs up the database.
See Also
- Backup and Restore in Depth - Every check and every edge case, and manual backups
- PostgreSQL Backups and Disaster Recovery - Reference and troubleshooting