Was looking up something for a backup operation and saw a command where someone was catting from ssh... I'd never thought of doing it before, but it does make sense:
ssh dbhost.example.com "pg_dumpall | gzip -c" > ~/cluster.sql.gzshould connect and dump the entire DB cluster (gzipped) to your local machine.
ssh dbhost.example.com "gunzip -c | pg_restore" < ~/cluster.sql.gzshould rebuild the database on the machine (assuming you've rebuilt the cluster in the meantime). One could, for that matter, pipe the result of the downloaded db directly into pg_restore on another machine (potentially also going over an ssh link). Of course, if your ssh link goes away, sucks to be you, but still a cool effect.
Pingbacks are closed.