刚配置的
MySQL主从,在从机上看到
-
mysql> SHOW slave STATUS \\G
-
*************************** 1. row ***************************
-
Slave_IO_State: Connecting to master
-
Master_Host: 172.17.210.199
-
Master_User: my
-
Master_Port: 3306
-
Connect_Retry: 60
-
Master_Log_File: masters-bin.000003
-
Read_Master_Log_Pos: 1224
-
Relay_Log_File: testmysql-relay-bin.000001
-
Relay_Log_Pos: 4
-
Relay_Master_Log_File: masters-bin.000003
-
Slave_IO_Running: Connecting
-
Slave_SQL_Running: Yes
-
Replicate_Do_DB:
-
Replicate_Ignore_DB:
看日志有很多:
-
141010 0:02:48 [ERROR] Slave I/O: error connecting to master \'my@172.17.210.199:3306\' - retry-time: 60 retries: 1, Error_code: 2003
-
141010 0:03:48 [ERROR] Slave I/O: error connecting to master \'my@172.17.210.199:3306\' - retry-time: 60 retries: 2, Error_code: 2003
-
141010 0:04:48 [ERROR] Slave I/O: error connecting to master \'my@172.17.210.199:3306\' - retry-time: 60 retries: 3, Error_code: 2003
-
141010 0:05:48 [ERROR] Slave I/O: error connecting to master \'my@172.17.210.199:3306\' - retry-time: 60 retries: 4, Error_code: 2003
-
141010 0:06:48 [ERROR] Slave I/O: error connecting to master \'my@172.17.210.199:3306\' - retry-time: 60 retries: 5, Error_code: 2003
-
141010 0:07:48 [ERROR] Slave I/O: error connecting to master \'my@172.17.210.199:3306\' - retry-time: 60 retries: 6, Error_code: 2003
-
解决方法:
-
-
导致lave_IO_Running 为connecting 的原因主要有以下 3 个方面:
-
-
1、网络不通
-
2、密码不对
-
3、pos不对
-
-
解决步骤:
-
1、对于第一个问题,一般情况下都是可以排除的,也是最容易排除的。
-
2、在主库上修改用来复制的用户的密码。
-
3、 在做chang to 的时候注意log_pos 是否跟此时主机的一样。在主机上 show master status \G ;可以查看到
mysql> show master status \G;
*************************** 1. row ***************************
File: masters-bin.000003
Position: 2392
Binlog_Do_DB:
Binlog_Ignore_DB:
Executed_Gtid_Set:
1 row in set (0.00 sec)
ERROR:
No query specified
从机上面执行change to 的正确
CHANGE MASTER TO
MASTER_HOST='172.17.210.199',
MASTER_USER='my',
MASTER_PASSWORD='123456',
MASTER_LOG_FILE='masters-bin.000003',
MASTER_LOG_POS= 2392;
我的问题,就是主机的防火墙没有关闭,犯了一个低级错误!!!!