Backup and restore
Manual backup process
PostgreSQL
This requires direct access to the PostgreSQL server from the machine on which the backup is done:
PGPASSWORD=<password> pg_dump -O -h <hostname> -U <username> <dbname> > <date>.sql
InfluxDB
The command for backing up the InfluxDB is the following:
influxd backup -portable -host <hostname>:8088 -database <dbname>
Manual restore process
Hibernating the Tenant by adding the option `hibernate: true` to the tenant's global configuration section and reapplying the tenant configuration:
global:
name: ...
hibernate: true
...
...
This config can then be applied with the following command:
helm upgrade -f <tenant-name>.yaml <tenant-name> <chart>
After a few moments, use kubectl
again to check if the tenant is fully hibernated:
kubectl get pods -n <tenant>
There should not be any pods left in the tenant (evicted pods can be ignored). Once the tenant is fully hibernated, the databases can be restored.
Restoring PostgreSQL
First ensure that the schema is cleared and any existing (possibly corrupted) data is deleted:
PGHOST=<host> PGPASSWORD=<password> PGUSER=<user> PGDATABASE=<dbname> psql -qAtX -c "DROP SCHEMA IF EXISTS %s CASCADE;"
Then, the actual backup can be applied:
PGHOST=<host> PGPASSWORD=<password> PGUSER=<user> PGDATABASE=<dbname> psql -f <filename>
Restoring InfluxDB
For restoring influxdb, simply run:
influxd restore -portable -host <hostname>:8088 <backup-dir>
Dehibernating the tenant
Remove the `hibernate=true` section from the config file again and apply the tenant's configuration again (see above for specific steps).