From bd74a923c94573f971c481a852f37166b3f88daf Mon Sep 17 00:00:00 2001 From: j Date: Fri, 7 Jul 2023 11:49:29 +0000 Subject: [PATCH] Add 'database backup' --- database-backup.md | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 database-backup.md diff --git a/database-backup.md b/database-backup.md new file mode 100644 index 0000000..fe8593f --- /dev/null +++ b/database-backup.md @@ -0,0 +1,23 @@ +## Pan.do/ra backup database + +as pandora user: + +``` +mkdir -p /srv/pandora/database +pg_dump pandora | gzip > /srv/pandora/database/pandora-`date -I`.psql.gz +``` + + +Restore database from backup: + +If needed create postgres db: +``` +sudo -u postgres createdb -T template0 --locale=C --encoding=UTF8 -O pandora pandora +echo "CREATE EXTENSION pg_trgm;" | sudo -u postgres psql pandora +``` + +load db from backup as pandora user + +``` +zcat /srv/pandora/database/pandora-2023-06-07.psql.gz | pandoractl manage dbshell +``` \ No newline at end of file