Perşembe, Temmuz 17, 2008

I love this game

Mysql to mysql backup through secured mysql connection between two ends.
The situation is this:
I have two mysql servers behind two modems. Only port 22 is open on modems.
Ports 3306 are open on both servers. First port forward on the server which is going to be backed up by
ssh -L 23306:127.0.0.1:3306 user@remoteserver(backupserver)
Then
mysqldump -t -u localuser -p db | mysql -v --host=127.0.0.1 --port=23306 -u remoteuser -p -C db
makes the magic.
By mysqldump we dump the mysqlserver which is going to be backed up. And point it to the local (forwarded) port 23306 and everything is written to the remote host.
Wow.
BTW, to connect to backup server from local we need this
mysql --host=127.0.0.1 --port=23306
thing.

Hiç yorum yok: