Tricks to backup db

When node is stopping, data might be lost.

Backup

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

Restore

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

本博客所有文章除特别声明外,均采用 CC BY-SA 4.0 协议 ,转载请注明出处!