[MySQL生产环境复制故障修复] Last_IO_Errno: 1045 Last_IO_Error: error connecting to master 'replication@

1  修复集群,start slave 报错如下:

  1. mysql> stop slave;  
  2. Query OK, 0 rows affected (0.10 sec)  
  1. -- 重新设置复制参数  
  2. mysql> change master to master_host='10.24.54.18',master_port=3306,master_user='replication',master_password='xxxxxx';  
  3. Query OK, 0 rows affected, 0 warnings (0.40 sec)  
  4.   
  5. mysql> start slave;  
  6. Query OK, 0 rows affected (0.01 sec)  
  7.   
  8. mysql>  show slave status\G;  
  9. *************************** 1. row ***************************  
  10.                Slave_IO_State: Connecting to master  
  11.                   Master_Host: 10.24.54.18  
  12.                   Master_User: replication  
  13.                   Master_Port: 3306  
  14.                 Connect_Retry: 60  
  15.               Master_Log_File: mysql-bin.000002  
  16.           Read_Master_Log_Pos: 1355028  
  17.                Relay_Log_File: mysql-relay-bin.000001  
  18.                 Relay_Log_Pos: 4  
  19.         Relay_Master_Log_File: mysql-bin.000002  
  20.              Slave_IO_Running: Connecting  
  21.             Slave_SQL_Running: Yes  
  22.               Replicate_Do_DB:   
  23.           Replicate_Ignore_DB:   
  24.            Replicate_Do_Table:   
  25.        Replicate_Ignore_Table:   
  26.       Replicate_Wild_Do_Table:   
  27.   Replicate_Wild_Ignore_Table:   
  28.                    Last_Errno: 0  
  29.                    Last_Error:   
  30.                  Skip_Counter: 0  
  31.           Exec_Master_Log_Pos: 1355028  
  32.               Relay_Log_Space: 107  
  33.               Until_Condition: None  
  34.                Until_Log_File:   
  35.                 Until_Log_Pos: 0  
  36.            Master_SSL_Allowed: No  
  37.            Master_SSL_CA_File:   
  38.            Master_SSL_CA_Path:   
  39.               Master_SSL_Cert:   
  40.             Master_SSL_Cipher:   
  41.                Master_SSL_Key:   
  42.         Seconds_Behind_Master: NULL  
  43. Master_SSL_Verify_Server_Cert: No  
  44.                 Last_IO_Errno: 1045  
  45.                 Last_IO_Error: error connecting to master 'replication@10.24.54.18:3306' - retry-time: 60  retries: 86400  
  46.                Last_SQL_Errno: 0  
  47.                Last_SQL_Error:   
  48.   Replicate_Ignore_Server_Ids:   
  49.              Master_Server_Id: 2  
  50. 1 row in set (0.00 sec)  
  51.   
  52. <pre name="code" class="sql">-- 报错如下: Last_IO_Errno: 1045</pre>ERROR: No query specified  


看问题,一开始怀疑是密码问题,但是密码都是复制上来的,没有变动,问题不大,还是看看check下别的情况吧。


2 ,check问题所在,ping ip地址,是OK的。

  1. [xxx@xxx-c004db1 shared]$ ping 10.24.54.18  
  2. PING 10.24.54.18 (10.24.54.1856(84) bytes of data.  
  3. 64 bytes from 10.24.54.18: icmp_seq=1 ttl=64 time=0.321 ms  
  4. 64 bytes from 10.24.54.18: icmp_seq=2 ttl=64 time=0.370 ms  
  5. ^C  
  6. --- 10.24.54.18 ping statistics ---  
  7. 2 packets transmitted, 2 received, 0% packet loss, time 1417ms  
  8. rtt min/avg/max/mdev = 0.321/0.345/0.370/0.030 ms  
  9. [xxx@xxx-c004db1 shared]$   

 

3 ,access 数据库端口3306,也是OK的。

  1. [xxx@xxx-c004db1 shared]$ ssh -v -p3306 10.24.54.18   
  2. OpenSSH_5.3p1, OpenSSL 1.0.0-fips 29 Mar 2010  
  3. debug1: Reading configuration data /etc/ssh/ssh_config  
  4. debug1: Applying options for *  
  5. debug1: Connecting to 10.24.54.18 [10.24.54.18] port 3306.  
  6. debug1: Connection established.  
  7. debug1: identity file /home/xxx/.ssh/xxx type -1  
  8. debug1: identity file /home/xxx/.ssh/id_rsa type -1  
  9. debug1: identity file /home/xxx/.ssh/id_dsa type -1  
  10. debug1: ssh_exchange_identification: O  
  11. ^C  


4,关闭防火墙service iptables stop,然后重启slave,还是报 Last_IO_Errno: 1045错误。


5,远程访问主库mysql 服务,报错如下:

  1. [xxx@xxx-c004db1 shared]$ mysql -h 10.24.54.18 -ureplication -pxxx  
  2. ERROR 1045 (28000): Access denied for user 'replication'@'xxx-xxx.abn-sjl.ea.com' (using password: YES)  
  3. [xxx@xxx-c004db1 shared]$   

仔细检查帐户,发现原来是执行grant语句的时候,密码串里面多了一个空格导致,同事的文本编辑器里面空格显示不明显,所以没有发现。


6,修复:去掉空格,重新执行grant语句,再重新启动slave,OK。

  1. mysql> show slave status\G  
  2. *************************** 1. row ***************************  
  3.                Slave_IO_State: Waiting for master to send event  
  4.                   Master_Host: 10.24.54.18  
  5.                   Master_User: replication  
  6.                   Master_Port: 3306  
  7.                 Connect_Retry: 60  
  8.               Master_Log_File: mysql-bin.000660  
  9.           Read_Master_Log_Pos: 34886442  
  10.                Relay_Log_File: mysql-relay-bin.001320  
  11.                 Relay_Log_Pos: 253  
  12.         Relay_Master_Log_File: mysql-bin.000660  
  13.              Slave_IO_Running: Yes  
  14.             Slave_SQL_Running: Yes  
  15.               Replicate_Do_DB:   
  16.           Replicate_Ignore_DB:   
  17.            Replicate_Do_Table:   
  18.        Replicate_Ignore_Table:   
  19.       Replicate_Wild_Do_Table:   
  20.   Replicate_Wild_Ignore_Table:   
  21.                    Last_Errno: 0  
  22.                    Last_Error:   
  23.                  Skip_Counter: 0  
  24.           Exec_Master_Log_Pos: 34886442  
  25.               Relay_Log_Space: 452  
  26.               Until_Condition: None  
  27.                Until_Log_File:   
  28.                 Until_Log_Pos: 0  
  29.            Master_SSL_Allowed: No  
  30.            Master_SSL_CA_File:   
  31.            Master_SSL_CA_Path:   
  32.               Master_SSL_Cert:   
  33.             Master_SSL_Cipher:   
  34.                Master_SSL_Key:   
  35.         Seconds_Behind_Master: 0  
  36. Master_SSL_Verify_Server_Cert: No  
  37.                 Last_IO_Errno: 0  
  38.                 Last_IO_Error:   
  39.                Last_SQL_Errno: 0  
  40.                Last_SQL_Error:   
  41.   Replicate_Ignore_Server_Ids:   
  42.              Master_Server_Id: 2  
  43. 1 row in set (0.00 sec)  


总结:DBA最重要的一点:细心,与大家共勉



  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值