我是 mysql 新手,正在尝试在 mysql 中建立主主复制
在第一台服务器上,我已将这些行添加到 my.cnf 的 mysqld 部分(mysql Ver 14.12 Distrib 5.0.77,适用于 redhat-linux-gnu (i686) 使用 readline 5.1)
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 部分(mysql Ver 14.14 Distrib 5.1.41,适用于 debian-linux-gnu (i486) 使用 readline 6.1)
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
我需要你的帮助。请发送你对此问题的建议和解决方案。
提前致谢。
问候,pradeep
答案1
看起来这是两个 mysql 服务器之间的通信问题。Last_IO_Error:连接 master 时出错'[电子邮件保护]:3306。
您是否验证过
1) 192.xxx.x.xxx 是否正在监听 192.xx.x.xxx 或 0.0.0.0/0
2) 另一台服务器(我们称之为 192.xx.x.yyy)是否可以连接到它?使用 mysql、netcat 或其他工具进行确定
似乎也没有输入主日志文件或位置。我确信配置中还有其他问题,读取您的配置和粘贴非常困难
答案2
你跑了吗改变主宰?