Db-support » History » Version 1
Version 1/13
-
Next » -
Current version
Philippe May, 17/07/2018 12:34
Database¶
Backups¶
Primary¶
The database is backed up every day at midnight. The dump file is located in /var/backups/postgres/
.
Secondary¶
The whole virtual machine is backed up by BackupNinja on the "dom0" controller, using:
- rdiff backups every day
- tar files on Saturdays.
See /etc/backups.d
on the dom0 (192.168.0.12).
Tertiary¶
TODO: remote backup.
Restoration¶
If the VM is not shutdown properly, there's a chance that the database is corrupt, and needs to be restored from one of the backups.
After the restoration, restart gisaf:
systemctl restart uwsgi.service
From primary backup¶
With user postgres
:
# Optionally, rename the corrupt database, selecting another name than @avgis_c2@ every time: psql -c "ALTER DATABASE avgis RENAME TO avgis_c2;" # Drop the existing database psql -c "drop database avgis;" # Create a new database: createdb -E utf8 -T template0 avgis # Restore the database pg_restore -d avgis /var/backups/postgres/avgis.pg_dump