gravity backup /var/lib/gravity/planet/share/backup.tar.gz
Configure Backup and Restore for Anypoint Platform PCE
To preserve your data in case of system failure or problems with other operations, such as patching or performing upgrades, ensure that your system is automatically backed up. Regular backups are extremely important for disaster recovery procedures. Configure your backup to run at least once per day; or more often depending on your requirements. Store your backup archive on external storage outside the Anypoint Platform cluster.
Anypoint Platform Private Cloud Edition (Anypoint Platform PCE) requires you to install, configure, and manage an NFS server. Ensure that you configure and perform frequent backups of this server.
Backup and restore for Anypoint Monitoring and Anypoint Visualizer are perfored outside the normal Gravity backup and restore mechanism, and require a separate procedure. |
Create a Backup
To create a backup, run the following command on any node in the cluster:
This command creates an archive of the current system state in: /var/lib/gravity/planet/share/backup.tar.gz
. You can pass the following optional parameters to the gravity backup command:
-
--follow
Outputs the backup job logs to stdout. In the following example,
tee
enables you to output to stdout and file at the same time:
gravity backup /var/lib/gravity/planet/share/backup.tar.gz --follow | tee -a /var/lib/gravity/planet/share/backup.log
-
--timeout
Specifies the deadline for the backup job, for example, 30s or 5m. Default is 20m.
Backup contents:
Information | Included in PCE Backup |
---|---|
Databases |
Y |
Configurations |
Y |
Secrets |
Y |
Object Store |
Y |
Disclaimer settings |
Y |
SMTP settings |
Y |
DNS settings |
N |
Platform certificate |
N |
Ops Center certificate |
N |
NFS settings |
N |
NFS files |
N |
Drives |
N |
Runtimes* |
N |
Anypoint Monitoring metrics |
N |
*Anypoint Platform PCE has information only about runtimes, such as their names and status.
Perform a System Restore
To restore a system from your backup archive, use the original cluster or create a new cluster.
Some settings, including NFS, certificates, and DNS, are not backed up and must be configured for the environment in which the restore will be performed before running the restore. |
You cannot perform a backup between different versions of Anypoint Platform PCE. The new installation you create must use the same version of Anypoint Platform PCE as your backup. |
-
Log in to one of the nodes in your cluster.
-
Move the compressed backup archive file to a folder on any main node in the environment to be restored. You can transfer this file securely by using the following command:
scp /backup-path/to-restore.tar.gz your_username@remotehost.edu:/var/lib/gravity/planet/share
-
Restore the cluster from the backup archive:
sudo gravity restore /var/lib/gravity/planet/share/to-restore.tar.gz
You can pass the following optional parameters:
-
--follow
Outputs the restore job logs to stdout.
-
--timeout
Specifies the maximum time allowed for the restore operation, for example, 30s, 5m, and so on. The default value is
80m
. If you have a very large number of applications and files, use a minimum of160m
as the--timeout
value.
-
-
Wait for the operation to complete, which is typically 40 to 60 minutes.
-
Manually restore the NFS files if you are not reusing the original NFS.
Anypoint Monitoring and Anypoint Visualizer
If Anypoint Monitoring and Anypoint Visualizer are enabled, follow these procedures to back up and restore them.
Anypoint Monitoring and Anypoint Visualizer backup and restore are outside the normal Gravity backup and restore mechanism, and require additional procedures. These components store metrics and other information, but they do not store platform configuration. Platform configuration information is handled by the system backup and restore procedures.
Anypoint Monitoring and Anypoint Visualizer must back up the data of the component InfluxDB (dias-prov-k8s-am-influxdb-comp
). Anypoint Monitoring and Anypoint Visualizer both store their configuration data in a Postgres database. The default Gravity mechanism backs up and restores this database.
Anypoint Monitoring and Anypoint Visualizer requires 4 TB volumes for amv
nodes. A full InfluxDB backup can be up to 8 TB of data. (Only two data nodes are operative.) You must provide enough free space on the target directory for the entire backup.
Restore time is proportional to the size of the backup. During restore, existing data on the target cluster will be backed up and erased upon user approval.
The backup and restore script must be run on a main node and must have sudo
access because it uses kubectl
. The script validates the restore disk size, databases, measurements, retention policies, and series cardinality for all measurements in each database.
Procedure
The InfluxDB backup and restore script is in the Anypoint Platform PCE environment: /var/lib/gravity/site/packages/unpacked/gravitational.io/anypoint/3.1.0*/resources/kubernetes/amv-backup-restore/amv-backup-restore.sh
The script has these parameters:
-a : (Required) action to perform : backup or restore. [string]. Default NO DEFAULT ACTION. -va : (optional) verbose output. Default non-verbose. -f : (Required) name of the tar file. Default for backup : dias-prov-k8s-am-influxdb-comp_YYYYMMD. [string]. Default for restore : /var/lib/data/influxdb/backup/dias-prov-k8s-am-influxdb-comp_YYYYMMDD.tar.gz. [Full Path]. -d : (Required for backup) full path to location where backup tar file is stored. Default for backup : /var/lib/data/influxdb/backup. [Full Path]. Default for restore : same as tar file path. [Full Path]. -s : (optional) Optional sub-component filter, use only for backup of only meta or only data. -h : Print HELP.