Postgres pg_dumpall with compression

Posted on Tuesday, May 15, 2012



To do this on an Ubuntu machine is relatively easy.
Just run the following commands.

First log in as the postgres user


       > sudo su postgres


Then run pg_dumpall and pipe it to a compression program, in my case I use bzip2



       >    pg_dumpall | bzip2 -vf > database.`date +"%Y.%m.%d"`.pgdumpall.bz2