When you combine the two commands, you can pass data between two hosts directly using SSH.
multiple SSH pipes
ssh user@host1 "mysqldump -u [user] -p[pwd] --no-create-db --no-create-info \
[db] [table] | gzip -c" | ssh user@host2 "gzip -c -d | mysql -h [host] -u [user] \
-p[pwd]"
Breaking this down a bit, you have two SSH commands, piped to each other:
- The first one runs the mysqldump, then pipes the result to gzip, which in turns sends the result to STDOUT.
- The second command takes STDIN and decompresses it, then pipes it to the mysql command.
Quelle:
https://serverfault.com/questions/760075/mysqldump-to-remote-mysql-database-using-gzip
Tags