[ERROR] Slave I/O: error connecting to master

刚配置的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; 

我的问题,就是主机的防火墙没有关闭 

==================================================================== 
由于主服务器异外重启, 导致从报错, 错误如下: 
show slave status错误: 
mysql> show slave status\G 
Master_Log_File: mysql-bin.000288 
Read_Master_Log_Pos: 627806304 
Relay_Log_File: mysql-relay-bin.000990 
Relay_Log_Pos: 627806457 
Relay_Master_Log_File: mysql-bin.000288 
Slave_IO_Running: No 
Slave_SQL_Running: Yes 
Exec_Master_Log_Pos: 627806304 
Relay_Log_Space: 627806663 

...... 
Last_IO_Error: Got fatal error 1236 from master when  reading data from binary log: 
'Client requested master to start  replication from impossible position' 
mysql错误日志: 

tail /data/mysql/mysql-error.log 
111010 17:35:49 [ERROR] Error reading packet from server: Client requested master 
to start replication from impossible position ( server_errno=1236) 
111010 17:35:49 [ERROR] Slave I/O: Got fatal error 1236 from master when reading data 
from binary log: 'Client requested master to start replication from impossible 
position', Error_code: 1236 
111010 17:35:49 [Note] Slave I/O thread exiting, read up to log 'mysql-bin.000288', 
position 627806304 
按照习惯, 先尝试必改position位置. 

mysql> stop slave; 
mysql> change master to master_log_file='mysql-bin.000288',master_log_pos=627625751; 
mysql> start slave; 
错误依旧, 接下来登陆到主服务器查看binlog日志. 
先按照错误点的标记去主服务器日志中查找: 

[root@db1 ~]# mysqlbinlog --start-position=627655136 /data/mysql/binlog/mysql-bin.000288 
/*!40019 SET @@session.max_insert_delayed_threads=0*/; 
/*!50003 SET @OLD_COMPLETION_TYPE=@@COMPLETION_TYPE,COMPLETION_TYPE=0*/; 
DELIMITER /*!*/; 
# at 4 
#111010 13:31:19 server id 4 end_log_pos 106 Start: binlog v 4, server v 5.1.45-log 
created 111010 13:31:19 
# Warning: this binlog is either in use or was not closed properly. 
BINLOG ' 
F1aTTg8EAAAAZgAAAGoAAAABAAQANS4xLjQ1LWxvZwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA 
AAAAAAAAAAAAAAAAAAAAAAAAEzgNAAgAEgAEBAQEEgAAUwAEGggAAAAICAgC 
'/*!*/; 
DELIMITER ; 
# End of log file 
ROLLBACK /* added by mysqlbinlog */; 
/*!50003 SET COMPLETION_TYPE=@OLD_COMPLETION_TYPE*/; 
没有看到这个位置. 

[root@db1 ~]# mysqlbinlog /data/mysql/binlog/mysql-bin.000288 > test.txt 

less text.txt 
看最后一部分 
# at 627625495 
#111010 16:35:46 server id 1 end_log_pos 627625631 Query thread_id=45613333 
exec_time=32758 error_code=0 
SET TIMESTAMP=1318289746/*!*/; 
delete from freeshipping_bef_update where part='AR-4006WLM' and code='' 
/*!*/; 
# at 627625631 
#111010 16:35:46 server id 1 end_log_pos 627625751 Query thread_id=45613333 
exec_time=32758 error_code=0 
SET TIMESTAMP=1318289746/*!*/; 
delete from shippingFee_special where part='AR-4006WLM' 
/*!*/; 
DELIMITER ; 
# End of log file 
ROLLBACK /* added by mysqlbinlog */; 
/*!50003 SET COMPLETION_TYPE=@OLD_COMPLETION_TYPE*/; 
找到最接近错误标记627655136的一个position是627625631. 

再回到slave机器上change master, 将postion指向这个位置. 

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

mysql> change master to master_log_file='mysql-bin.000288',master_log_pos=627625631; 
Query OK, 0 rows affected (0.06 sec) 

mysql> start slave; 
Query OK, 0 rows affected (0.00 sec) 
再次查看 

mysql> show slave status\G 
*************************** 1. row *************************** 
Slave_IO_State: Queueing master event to the relay log 
Master_Host: 192.168.21.105 
Master_User: rep 
Master_Port: 3306 
Connect_Retry: 10 
Master_Log_File: mysql-bin.000289 
Read_Master_Log_Pos: 25433767 
Relay_Log_File: mysql-relay-bin.000003 
Relay_Log_Pos: 630 
Relay_Master_Log_File: mysql-bin.000289 
Slave_IO_Running: Yes 
Slave_SQL_Running: Yes 
主从同步正常了, 同样的方法修复其它slave机器.

时间: 2024-09-20 15:31:32

[ERROR] Slave I/O: error connecting to master的相关文章

Last_IO_Error: error connecting to master 'tl@192.168.199.151:3306'

环境: centoos 6.5  主从 mysql 5.6.12 主: 192.168.199.11 从:192.168.199.12 主从切换 把 12 变为主,从为11  结果报错: Last_IO_Error: error connecting to master 'tl@192.168.199.151:3306' 11 从机上看到的: 刚配置的MySQL主从,在从机上看到 点击(此处)折叠或打开 mysql> SHOW slave STATUS \\G *****************

FAILED: Hive Internal Error: java.lang.RuntimeException(Error while making MR scratch directory异常的解决

hive> select * from dummy; FAILED: Hive Internal Error: java.lang.RuntimeException(Error while making MR scratch directory - check filesystem config (null)) java.lang.RuntimeException: Error while making MR scratch directory - check filesystem config

Database Crash With ORA-27063 and OS Error: 5: I/O Error

Oracle Database - Enterprise Edition - Version 8.1.6.0 to 11.2.0.0 [Release 8.1.6 to 11.2]Oracle Database - Enterprise Edition - Version 11.2.0.2 to 11.2.0.2 [Release 11.2]Information in this document applies to any platform.***Checked for relevance

lnk1112- C++与MATLAB混合编程问题, error LNK2019与fatal error LNK1112

问题描述 C++与MATLAB混合编程问题, error LNK2019与fatal error LNK1112 为什么最简单的例子都没有办法实现,一直提示无法解析的外部符号.感觉需要的环境应该配置对了啊,求助! 具体问题请移步到论坛:http://bbs.csdn.net/topics/390921793

TNS-12537, TNS-12560,TNS-00507 Linux Error: 29: Illegal seek error

TNS-12537, TNS-12560,TNS-00507 Linux Error: 29: Illegal seek error 错误现象: TNS-12537: TNS:connectionclosed  TNS-12560: TNS:protocol adapter error   TNS-00507: Connection closed    Linux Error: 29: Illegal seek   参考文档: 参考:Metalink[ID 315720.1] TNS Liste

psql error: psql: symbol lookup error: psql: undefined symbol: PQconnectdbParams

linux遇到一个Postgresql的问题,在调用pg_restore时: ./pg_restore -h 127.0.0.1 -p 5432 -U postgres -v -d dbname /usr/local/backup.tar 出了一个错 psql error: psql: symbol lookup error: psql: undefined symbol: PQconnectdbParams 由于此程序用的pg_restore是单独的,而现在linux系统上也装了一个postg

SAP WM LT03 Error Msg - An internal error has occurred (L03T 0152 H) – 之对策

SAP WM LT03 Error Msg - An internal error has occurred (L03T 0152 H) – 之对策 LT03 试图为交货单 81749010 创建TO 单,系统报错如下:     经查,需要修改相应的WM 移动类型的配置,       把311 移动类型的Screen Control中TO Creation的选项值维护成2(Stk mvl prep),再次LT03就成功了:            

MySQL主从失败错误:Got fatal error 1236

同事给我打电话说团购数据库主从不同步了,速度开电脑拨VPN解决. 1.登录从库查看主从同步状态,确实是否不同步 mysql> show slave status\G *************************** 1. row *************************** Slave_IO_State: Master_Host: 10.10.0.236 Master_User: slave Master_Port: 3306 Connect_Retry: 60 Master_L

MySQL主从失败 错误Got fatal error 1236

原创作品,允许转载,转载时请务必以超链接形式标明文章 原始出处 .作者信息和本声明.否则将追究法律责任.http://navyaijm.blog.51cto.com/4647068/1233404 刚洗完澡准备睡觉,同事给我打电话说团购数据库主从不同步了,尼玛,咋就这么苦逼呢,好吧,速度开电脑拨VPN解决. 1.登录从库查看主从同步状态,确实是否不同步 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27