MySQL Replication Over SSH - Last_IO_Errno: 2003 - error connecting to master

Posted by Dom on Server Fault See other posts from Server Fault or by Dom
Published on 2013-08-07T09:23:37Z Indexed on 2014/06/02 3:32 UTC
Read the original article Hit count: 2157

Filed under:
|
|

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.

© Server Fault or respective owner

Related posts about mysql

Related posts about ssh