Sauvegarde d’une base de données Postgres

Sauvegarde d’une base de données PostgreSQL

Mayan EMDS

docker exec -i mayan-edms-postgres /bin/bash -c "PGPASSWORD=mayanuserpass pg_dump --username mayan mayan" > /volume1/docker/mayan-edms/postgres/dump.sql

Paperless-ngx

docker exec -i paperlessngx-db-1 /bin/bash -c "PGPASSWORD=paperless pg_dump --username paperless paperless" > /volume1/docker/paperdb/dump.sql

Vérification du dump

cat /volume1/docker/paperdb/dump.sql | more

Restauration d’une base de données

Mayan EDMS

docker exec -i mayan-edms-postgres /bin/bash -c "PGPASSWORD=mayanuserpass psql --username mayan mayan --set ON_ERROR_STOP=on" < /volume1/docker/mayan-edms/postgres/dump.sql

Paperless-ngx

docker exec -i paperlessngx-db-1 /bin/bash -c "PGPASSWORD=paperless psql --username paperless paperless --set ON_ERROR_STOP=on" < /volume1/docker/paperdb/dump.sql

Source

  • https://www.cloudytuts.com/tutorials/docker/how-to-upgrade-postgresql-in-docker-and-kubernetes/