Add 'database backup'
parent
b8549c9467
commit
bd74a923c9
1 changed files with 23 additions and 0 deletions
23
database-backup.md
Normal file
23
database-backup.md
Normal file
|
@ -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
|
||||||
|
```
|
Loading…
Reference in a new issue