Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I'm trying to setup a mysql replication over an SSH tunnel. The odd thing about this setup is that I have one master with mysql 5.0.60sp1-enterprise-gpl-log and one slave with mysql 5.0.67-community-log. Could it be so that it's not possible to replicate between community and enterprise edition?

As you can see in my log below, it's possible to login on the remote server with the mysql client. But the replication get "Can't connect to MySQL server on '127.0.0.1' (13)"

Is it any log file I have forgotten to look in, to get more info?

[root@mysql1-av ~]# mysql -uroot -p
Enter password: 
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 73
Server version: 5.0.67-community-log MySQL Community Edition (GPL)

Type 'help;' or '\h' for help. Type '\c' to clear the buffer.

The version of the slave mysql

[root@mysql1-av ~]# autossh -f -M 20001 -L 3307:10.200.200.200:3306 dali@www.ourbounceserver.com -N

[root@mysql1-av ~]# mysql -h127.0.0.1 --port 3307 -uroot -p
Enter password: 
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 5189
Server version: 5.0.60sp1-enterprise-gpl-log MySQL Enterprise Server (GPL)

Type 'help;' or '\h' for help. Type '\c' to clear the buffer.

mysql> Aborted

Login to the master mysql with the mysql client over the ssh tunnel.

[root@mysql1-av ~]# mysql -uroot -p
Enter password: 
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 75
Server version: 5.0.67-community-log MySQL Community Edition (GPL)

Type 'help;' or '\h' for help. Type '\c' to clear the buffer.

mysql> change master to master_host='127.0.0.1', MASTER_PORT=3307, master_user='xxxx', master_password='xxxx', master_log_file='bin.000001';
Query OK, 0 rows affected (0.00 sec)

mysql> start slave;
Query OK, 0 rows affected (0.00 sec)

mysql> show slave status \G
*************************** 1. row ***************************
             Slave_IO_State: Connecting to master
                Master_Host: 127.0.0.1
                Master_User: replNSG
                Master_Port: 3307
              Connect_Retry: 60
            Master_Log_File: bin.000001
        Read_Master_Log_Pos: 4
             Relay_Log_File: relay.000001
              Relay_Log_Pos: 98
      Relay_Master_Log_File: bin.000001
           Slave_IO_Running: No
          Slave_SQL_Running: Yes
            Replicate_Do_DB: 
        Replicate_Ignore_DB: 
         Replicate_Do_Table: 
     Replicate_Ignore_Table: 
    Replicate_Wild_Do_Table: 
Replicate_Wild_Ignore_Table: 
                 Last_Errno: 0
                 Last_Error: 
               Skip_Counter: 0
        Exec_Master_Log_Pos: 4
            Relay_Log_Space: 98
            Until_Condition: None
             Until_Log_File: 
              Until_Log_Pos: 0
         Master_SSL_Allowed: No
         Master_SSL_CA_File: 
         Master_SSL_CA_Path: 
            Master_SSL_Cert: 
          Master_SSL_Cipher: 
             Master_SSL_Key: 
      Seconds_Behind_Master: NULL
1 row in set (0.00 sec)

Start the replication, but it breaks on IO.

[root@mysql1-av ~]# tail /var/log/mysqld.log
120921 22:17:59 [Note] Slave I/O thread killed while connecting to master
120921 22:17:59 [Note] Slave I/O thread exiting, read up to log 'bin.000001', position 4
120921 22:17:59 [Note] Error reading relay log event: slave SQL thread was killed
120921 22:29:36 [Note] Slave SQL thread initialized, starting replication in log 'bin.000001' at position 4, relay log '/var/lib/mysql/relay.000001' position: 4
120921 22:29:36 [ERROR] Slave I/O thread: error connecting to master 'xxxx@127.0.0.1:3307': Error: 'Can't connect to MySQL server on '127.0.0.1' (13)'  errno: 2003  retry-time: 60  retries: 86400

Because it can't connect to the master server.

share|improve this question
add comment

3 Answers

MySQL -- even 5.0 -- has native support for SSL-wrapped replication. Unless there's a compelling reason to use ssh tunnels, I'd recommend using it.

http://dev.mysql.com/doc/refman/5.0/en/replication-solutions-ssl.html

share|improve this answer
    
Can you bounce on a front-server with the SSL-wrap? Can't find any info about it. Our mysql server don't have access to internet directly. –  Arlukin Sep 21 '12 at 21:40
    
I'm not sure I understand what you're asking. –  MrTuttle Sep 21 '12 at 21:43
    
I have access to www.ourbounceserver.com from internet, and the mysql server is on the local net on 10.200.200.200. So I need to tunnel all traffic trough the www.ourbounceserver.com server. I guess you need direct access between the two servers to use SSL. –  Arlukin Sep 21 '12 at 21:51
add comment
up vote 0 down vote accepted

I have now solved the problem. It's a bug in the mysql replication command "change master" and the argument "MASTER_PORT=3307". It doesn't care about that argument, and always uses port 3306.

When using a MySQL 5.0.18 slave, if the master is listening on any port other than 3306, replication fails even when master_port is set to the correct listening port on the master.

http://bugs.mysql.com/bug.php?id=17105

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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