I am using AWS RDS and wish to backup my primary db hourly to a DR site in another region
What I need is a mysql command which will export the db and import into another mysql server running in a different location
I am looking into using something like the following
$ mysqldump -umy_user -pmy_pass_1 -R my_database my_table | mysql -umy_user -pmy_pass_2 my_database
However I cannot seem to specify a host for the export db, how can I acheieve this?
I also need to consider security so would like this over SSL, any idea?
[edit]: got this sort of working by the following process
On a linux node in my primary site ran a mysqldump and then ran a mysql command to import into the dr site e.g.
mysqldump -P 3306 -h primary.com -u user --password=pass mydb > test.sql;
mysql -P 3306 -h dr.com -u user --password=pass mydb < test.sql;
However I still need this to be secure
mysqldump
accepts ssl
arguments:
--ssl Enable SSL for connection (automatically enabled with
other flags).
--ssl-ca=name CA file in PEM format (check OpenSSL docs, implies
--ssl).
--ssl-capath=name CA directory (check OpenSSL docs, implies --ssl).
--ssl-cert=name X509 cert in PEM format (implies --ssl).
--ssl-cipher=name SSL cipher to use (implies --ssl).
--ssl-key=name X509 key in PEM format (implies --ssl).
--ssl-verify-server-cert
Verify server's "Common Name" in its cert against
hostname used when connecting. This option is disabled by
default.
Set up the proper certs and it should be straightforward. Good details are here.