I have MySQL MASTER/SLAVE replication working on two test boxes (Centos 6.4 / MySQL 5.5.32) over LAN.
Securing the connection over
ssh causes connection problems from the SLAVE machine:
(Sample of show slave status \G Output)
Last_IO_Errno: 2003
Last_IO_Error: error connecting to master '
[email protected]:3305' - retry-time: 60
I have granted the replication user the relevant privileges on the master server with both 127.0.0.1 and the network IP.
I have forwarded the port from slave to master over
SSH
ssh -f 192.168.0.128 -L 3305:192.168.0.128:3306 -N
I can connect to master MySQL from slave with
mysql -urep -ppassword -h127.0.0.1 -P3305
The master server setup would seem fine, as it works without a tunnel, and the tunnel seems fine, as I can connect to MySQL between the two.
Change Master Statement:
CHANGE MASTER TO MASTER_HOST='127.0.0.1', MASTER_PORT=3305, MASTER_USER='rep', MASTER_PASSWORD='password';
Note: I know there are reasons to use SSL, instead of
SSH, but I have reasons why
SSH is a better choice for my setup.