0

I'm attempting to replicate from an external MySQL master to an RDS instance. I don't really want to be sending data in the clear over the Internet, so I have an EC2 instance that I have set up an ssh tunnel on. The tunnel opens port 3307 on the EC2 instance, and connects to the external instance that is running the target master MySQL DB. From that EC2 instance I can run

mysql -u <user> -p -h 127.0.0.1 -P3307

and connect to the target remote DB. All is well there. Furthermore, I can connect to the RDS DB from this instance without problems.

The problem I'm having is that when I set up the replication parameters on my RDS instance, I cannot connect to the remote instance. I'm doing something along the lines of (from the EC2 instance that has access to both DB's):

mysql.rds_set_external_master('<host>', 3307, 'repl_user', '<repl_pass>', 'mysql-bin.000001', 107, 0);

... where has been 'localhost', '127.0.0.1', the private DNS name of the EC2 instance, the private IP, the public IP and the public DNS. On each try, running SHOW SLAVE STATUS\G displays an error along the lines of:

Last_IO_Error: error connecting to master 'repl_user@<host>:3307'

My question is: When running the rds_set_external_master call, is the host relative to the client that's sending the call or relative to the RDS instance? If the latter, how can I tunnel to my remote instance?

0

OK, let this be a lesson to anyone in my position. When you set up your tunnel, if you don;t specify the IP of the machine (or 0.0.0.0), it'll bind to loopback, and so will be private to the instance that spawned it.

Do this:

ssh -N -f -L *:3307:<external IP>:3306 user@remote

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.