通过ssh在mysql 5.0.xx社区和企业版之间复制

我试图通过SSH隧道build立一个mysql复制。 关于这个设置的奇怪的事情是,我有一个与MySQL 5.0.60sp1-enterprise-gpl-log的主和一个与MySQL 5.0.67-community-log的奴隶。 是不是可以在社区版和企业版之间进行复制?

正如你可以在下面的日志中看到的,可以使用mysql客户端在远程服务器上login。 但复制得到“无法连接到'127.0.0.1'(13)上的MySQL服务器”

是否有任何我忘记查看的日志文件,以获取更多信息?

[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. 

奴隶mysql的版本

 [root@mysql1-av ~]# autossh -f -M 20001 -L 3307:10.200.200.200:3306 [email protected] -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 

用mysql客户端通过ssh隧道login到master mysql。

 [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) 

启动复制,但它打破了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 '[email protected]:3307': Error: 'Can't connect to MySQL server on '127.0.0.1' (13)' errno: 2003 retry-time: 60 retries: 86400 

因为它无法连接到主服务器。

MySQL – 甚至是5.0 – 具有对SSL封装复制的本地支持。 除非有令人信服的理由使用SSH隧道,否则我build议使用它。

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

我现在已经解决了这个问题。 这是mysql复制命令“change master”和参数“MASTER_PORT = 3307”中的一个错误。 它不关心这个参数,总是使用端口3306。

当使用MySQL 5.0.18从机时,如果主机正在侦听除3306以外的任何端口,则即使master_port设置为主机上正确的侦听端口,复制也会失败。

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