[bitfolk] mysqldump over SSH (Was: Re: The perils of opening…

Αρχική Σελίδα
Συντάκτης: Andy Smith
Ημερομηνία:  
Προς: users
Παλιά Θέματα: Re: [bitfolk] The perils of opening tcp/22 to the Internet
Αντικείμενο: [bitfolk] mysqldump over SSH (Was: Re: The perils of openingtcp/22 to the Internet)

Reply to this message
gpg: Signature made Sun Mar 14 14:13:35 2010 UTC using DSA key ID BF15490B
gpg: Good signature from "Andy Smith <andy@strugglers.net>"
gpg: aka "Andrew James Smith <andy@strugglers.net>"
gpg: aka "Andy Smith (UKUUG) <andy.smith@ukuug.org>"
gpg: aka "Andy Smith (BitFolk Ltd.) <andy@bitfolk.com>"
gpg: aka "Andy Smith (Linux User Groups UK) <andy@lug.org.uk>"
gpg: aka "Andy Smith (Cernio Technology Cooperative) <andy.smith@cernio.com>"
Hello,

On Sun, Mar 14, 2010 at 01:46:40PM +0000, James Gregory wrote:
> You can't easily do MySQL dump backups over SSH for example!


Well, mysqldump typically outputs to stdout so you can just pipe that
through SSH without issue. gzip it as well if you like:

mysqldump -u dbuser dbname | gzip -c --best --rsyncable | ssh dbbackup@??? 'cat > /data/backup/dbbackup.sql.gz'

The usual problem with backing up a database *from* outside the box
it's on is that just copying the files on disk won't usually provide
a consistent (or in some cases, an at all usable) backup. But
mysqldump from the db host itself through SSH doesn't suffer from
that problem.

(it has some other problems)

Cheers,
Andy

-- 
http://bitfolk.com/ -- No-nonsense VPS hosting