Set up a disaster-recovery site¶
This page explains how to prepare a standby QubeSight server at a second site so that you can take over quickly if the primary site is lost: what to place where, how to prepare the standby server, and the two supported procedures (the recommended backup-location procedure and the older recovery-bundle procedure).
Community Enterprise
Backup, restore and the procedures on this page work in both editions. The disaster-recovery screens (readiness, drills and topology in Platform → Data and Backup → DR) are Enterprise. For automatic failover inside one site, use a cluster instead: see Add cluster nodes and a witness.
The model¶
QubeSight disaster recovery is a cold or warm standby. The standby server is prepared in advance and takes the primary's data from its backups when needed. There is no continuous replication between the sites.
flowchart LR
P[Primary site<br/>QubeSight] -->|locked archive every 10 min<br/>encrypted backups| B[(Backup location<br/>second site)]
B -->|restore on takeover| D[DR site<br/>prepared server]
What decides your recovery point:
| Data | Recovery point |
|---|---|
| Activity logs | About 10 to 12 minutes (blocks not yet written to the locked store are lost) |
| Configuration (users, rules, integrations) | The configuration backup interval |
| Guardium live rows not yet finalized | Not in the backup; the next day's Guardium archive brings them back |
Recommended procedure: backup location and passphrase¶
With this procedure, the backup location and the backup passphrase are all you need, even if every primary server is lost.
On the primary¶
- Put the backup location at the DR site or in a third place, never on the primary server:
- a locked store (cold storage) on a separate server or in S3: choose S3/MinIO on another server (Enterprise) or Install a MinIO vault on another server (Enterprise) at installation, or change it in Platform → Data and Backup → Retention; or
- an SFTP server: Platform → Data and Backup → Backup settings.
- Set your own backup passphrase in Backup settings (not the default) and store it in your password vault, separately from the backup location credentials.
- Check that scheduled backups succeed in Platform → Data and Backup → Backup, and run a restore drill (see Disaster-recovery drill).
On the DR server, in advance¶
- Install the operating system and Docker (or Podman) as for any installation; see System requirements and sizing. Size it for the primary's load.
- Unpack the same QubeSight release as the primary (the restore needs at least the version that took the backup). Keep it updated when the primary is updated.
- If the DR site has no internet access, load the images now; see Offline (air-gapped) installation.
- Make sure the DR server can reach the backup location, and that the log sources can be redirected to it (DNS name, virtual IP plan, firewall rules).
- Keep the access details of the backup location (store keys, or SFTP user, password and host key fingerprint) available at the DR site.
Do not install QubeSight on the DR server yet. Installing an empty system and restoring later works too, but a restore onto an existing installation replaces its configuration database.
In a disaster¶
Restore on the DR server with the web installer (Restore from backup) or with install.sh --restore-from. The full procedure, every field and the cluster-aware cases are in Restore from a backup.
cd /opt/qubesight
export QUBESIGHT_BACKUP_PASSPHRASE="$(cat /root/qs-backup.pass)"
export QS_RESTORE_S3_ACCESS_KEY="$(cat /root/restore-access)"
export QS_RESTORE_S3_SECRET_KEY="$(cat /root/restore-secret)"
sudo -E ./install.sh --yes --public-host qubesight-dr.example.com \
--restore-from minio --restore-endpoint 198.51.100.20:9100 --restore-secure \
--restore-bucket qubesight-worm
Then:
- Sign in with an account from the primary.
- Redirect log sources (Guardium syslog and SNMP targets, Filebeat) to the DR server or move the DNS name.
- Check Platform → Data and Backup → Backup settings: after the restore the DR server is the primary, and scheduled backups are on if they were on at the source.
- Watch the restore banner until the ClickHouse data is back.
Older procedure: recovery bundle and S3 backups¶
Before the backup passphrase existed, a DR server was installed with the primary's keys from a recovery bundle, and backups were restored from an S3 target with a command. This procedure still works.
1. On the primary (once, and again whenever a key changes): enable backups to an S3-compatible target reachable from the DR site, then export the recovery bundle. The bundle contains the primary's active GUARDIUM_SECRET_KEY, QUBESIGHT_MFA_KEY and BACKUP_ENCRYPTION_KEY, encrypted with a passphrase of at least 12 characters given in an environment variable:
docker compose exec -T -e QUBESIGHT_RECOVERY_PASSPHRASE control-plane \
./control-plane -export-recovery-bundle /tmp/primary.qsrecovery
docker compose cp control-plane:/tmp/primary.qsrecovery ./primary.qsrecovery
docker compose exec -T control-plane rm -f /tmp/primary.qsrecovery
The bundle is written inside the control-plane container; the last two commands copy it to the host and remove the copy in the container.
The command writes the file with mode 0600 and prints a one-line JSON summary (file, number of keys, source version). If the primary still runs with the built-in default GUARDIUM_SECRET_KEY, it warns that the DR server will receive the same key and recommends rotating it. Store the bundle and its passphrase in different places.
2. Install the DR server with the bundle. The keys are written to .env before any service starts; a wrong passphrase or a modified file stops the installation:
export QUBESIGHT_RECOVERY_PASSPHRASE="$(cat /root/bundle.pass)"
sudo -E ./install.sh --yes --public-host qubesight-dr.example.com --recovery-bundle /root/primary.qsrecovery
3. In a disaster, stop the application services, restore the latest backups, and start them again:
docker compose stop control-plane worker snmp-trap
docker compose run --rm --no-deps -T -e QS_RESTORE_S3_ACCESS_KEY -e QS_RESTORE_S3_SECRET_KEY control-plane \
./control-plane -restore-backup --yes --s3-endpoint https://198.51.100.20:9000 --s3-bucket qubesight-backups --s3-prefix qubesight
docker compose start control-plane worker snmp-trap
-restore-backup option |
Meaning |
|---|---|
--s3-endpoint, --s3-bucket |
Required: the backup target's address and bucket |
--s3-prefix |
The prefix from the primary's backup settings (default qubesight) |
QS_RESTORE_S3_ACCESS_KEY, QS_RESTORE_S3_SECRET_KEY |
Required environment variables: the access keys of the backup target (never on the command line) |
--s3-clickhouse-endpoint |
Address ClickHouse uses to reach S3, if different |
--s3-region |
S3 region of the backup target (default us-east-1) |
--yes |
Required: confirms that the DR server's databases are replaced with the primary's |
--skip-postgres, --skip-clickhouse |
Restore only one of the two |
--pg-key |
A specific PostgreSQL backup (default: the newest) |
--clickhouse-source-db |
The primary's ClickHouse database (default default) |
PostgreSQL is restored first; if it fails, ClickHouse is not attempted. The command stops after at most 6 hours. The output is a one-line JSON report (ok, table and row counts, duration, problems); the exit code is 0 on success, 1 on a failed restore and 2 when a required option is missing. The primary's scheduled backup is paused on the DR server after a restore, so that the DR server does not overwrite the primary's backups; re-enable it with a new target when the DR server becomes the primary.
Limitations¶
- No continuous replication: data after the last backup or archive block is not on the DR site.
- Failing back to the primary site is the same procedure in the opposite direction, done manually.
- While both sites run, scheduled jobs other than backups (for example notifications) can run on both; decide the takeover before starting the DR services.
- The recovery bundle has no download button in the interface; it is exported on the command line.