在MySQL中掌握主复制

我是新来的MySQL,并试图build立在MySQL主主复制

在第一台服务器上,我已经将这些行添加到my.cnf的mysqld部分(mysql Ver 14.12 Distrib 5.0.77,对于使用readline 5.1的redhat-linux-gnu(i686))

datadir=/var/lib/mysql socket=/var/lib/mysql/mysql.sock log-bin=/var/lib/mysql/mysql-bin.log binlog-do-db=sample1 binlog-ignore-db=mysql binlog-ignore-db=information_schema binlog-ignore-db=test2 binlog-ignore-db=sample3 binlog-ignore-db=example3 binlog-ignore-db=endpoints binlog-ignore-db=meetme binlog-ignore-db=test binlog-ignore-db=sample2 server-id=1 master-host = 192.xxx.x.xxx master-user = abc master-password = abc_pass master-connect-retry = 60 relay-log = /var/lib/mysql/slave-relay.log relay-log-index = /var/lib/mysql/slave-relay-log.index 

在第二台服务器上,我已经将这些行添加到my.cnf的mysqld部分(对于使用readline 6.1的debian-linux-gnu(i486),mysql Ver 14.14 Distrib 5.1.41)

 server-id=2 master-host = 192.xxx.x.xxx master-user = xyz master-password = xyz_pass master-connect-retry = 60 relay-log = /var/lib/mysql/slave-relay.log relay-log-index = /var/lib/mysql/slave-relay-log.index log-bin = /var/lib/mysql/mysql-bin.log binlog-do-db = sample1 binlog-ignore-db=mysql binlog-ignore-db=information_schema binlog-ignore-db=phpmyadmin 

在第一台服务器的从属状态是

 *************************** 1. row *************************** Slave_IO_State: Connecting to master Master_Host: 192.xxx.x.xx Master_User: abc Master_Port: 3306 Connect_Retry: 60 Master_Log_File: mysql-bin.000001 Read_Master_Log_Pos: 36158 Relay_Log_File: slave-relay.000001 Relay_Log_Pos: 98 Relay_Master_Log_File: mysql-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: 36158 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) ERROR: No query specified 

在第二台服务器的从属状态是

 *************************** 1. row *************************** Slave_IO_State: Connecting to master Master_Host: 192.xxx.x.xxx Master_User: xyz Master_Port: 3306 Connect_Retry: 60 Master_Log_File: Read_Master_Log_Pos: 4 Relay_Log_File: slave-relay.000003 Relay_Log_Pos: 4 Relay_Master_Log_File: 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: 5 Exec_Master_Log_Pos: 0 Relay_Log_Space: 106 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 Master_SSL_Verify_Server_Cert: No Last_IO_Errno: 1045 Last_IO_Error: error connecting to master '[email protected]:3306' - retry-time: 60 retries: 86400 Last_SQL_Errno: 0 Last_SQL_Error: 1 row in set (0.00 sec) ERROR: No query specified 

不知道为什么Slave_IO_Running不是。

我已经尝试了很多开始复制,但我仍然无法启动复制。 我也评论过

 #bind-address = 127.0.0.1 

 #skip-external-locking 

我需要你的帮助。 请发送你的build议和解决这个问题。

提前致谢。

问候,pradeep

似乎这是两个mysql服务器之间的通信问题。 Last_IO_Error:连接到主机“[email protected]:3306”时出错。

你确认了吗?
1)192.xxx.x.xxx正在侦听192.xx.x.xxx或0.0.0.0/0
2)另一台服务器,让我们打电话192.xx.x.yyy可以连接到它? 确定与MySQL,netcat或者其他东西

也似乎没有主日志文件,也没有进入位置。 我确定configuration还有其他问题,读取configuration和粘贴非常困难

你有没有跑CHANGE MASTER ?