Skip to content

Latest commit

 

History

History
16 lines (12 loc) · 381 Bytes

backup_restore_pg_com_zstd.md

File metadata and controls

16 lines (12 loc) · 381 Bytes

Backup e restore postgres com zstd

Executar dump com zstd

DATE="$(date "+%Y-%m-%d_%H-%M")"
DATABASE="banco"
DUMP_NAME="/tmp/${DATABASE}_${DATE}.sql"

pg_dump -U postgres -C "${DATABASE}" | zstd --rm -o "${DUMP_NAME}.zst"

Restaurar dump compactado com zstd

zstd -cdk --no-progress arquivo_dump.sql.zst | psql -U postgres -W -h localhost postgres