Posted on

Tricks to backup db

When node is stopping, data might be lost.

Backup

docker exec -t your-db-container pg_dumpall -c -U postgres > dump_`date +%d-%m-%Y"_"%H_%M_%S`.sql

Restore

cat your_dump.sql | docker exec -i your-db-container psql -U postgres