Mysqldump compression, which is SSH'd on another machine

I have the following:

 mysqldump -u xxxx 
           -h localhost 
           --password=xxxxx databasename | 
           ssh username@00.000.00.202 "dd of=httpdocs/backup`date +'%Y-%m-%d-%H-%M-%S'`.sql"

... which ssh is mysqldump for the remote machine.

I need to compress mysqldump before it is SSH'd since the dump is 500 MB and it eats up my bandwidth.

+5
source share
4 answers

mysqldump ... | gzip -9 | ssh ...

or

mysqldump ... | bzip2 -9 | ssh ...

or if you want it to be uncompressed on the other end

mysqldump ... | bzip2 -9 | ssh machine "bzip2 -d >..."

mysqldump ... | gzip -9 | ssh machine "gzip -d >..."

+10
source

You can add a flag -Cto the call sshto automatically compress the transmitted data.

+7
source

gzip mysqldump ssh, :

mysqldump [mysql options] | gzip | ssh [ssh options]

".sql.gz".

+2

, , .

The Percona OpenSource xtrabackup application will perform compressed (TAR) backups on the fly - along with many other interesting things.

I could not find the anchor on the page, but scroll down to "Compressed backups."

0
source

All Articles