mysql> show slave status\G;
*************************** 1. row ***************************
Slave_IO_State:
Master_Host: 192.168.25.57
Master_User: repl
Master_Port: 3306
Connect_Retry: 60
Master_Log_File: mysqld-bin.000014
Read_Master_Log_Pos: 107
Relay_Log_File: mysql-relay-bin.000001
Relay_Log_Pos: 4
Relay_Master_Log_File: mysqld-bin.000014
Slave_IO_Running: No
Slave_SQL_Running: YES
Replicate_Do_DB: discuz
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: 107
Relay_Log_Space: 107
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: 1236
Last_IO_Error: Got fatal error 1236 from master when reading data from binary log: ‘Could not find first log file name in binary log index file’
Last_SQL_Errno: 0
Last_SQL_Error:
Replicate_Ignore_Server_Ids:
Master_Server_Id: 1
1 row in set (0.00 sec)
ERROR:
No query specified
解决办法:
从机器停止slave
mysql> slave stop;
到master机器登陆mysql:
记录master的bin的位置,例如:mysql> show mster status;
+——————+———-+————–+——————+
| File | Position | Binlog_Do_DB | Binlog_Ignore_DB |
+——————+———-+————–+——————+
| mysql-bin.000013 | 107 | discuz | |
+——————+———-+————–+——————+
1 row in set (0.00 sec)
日志为mysqld-bin.000013
刷新日志:mysql> flush logs;
因为刷新日志file的位置会+1,即File变成为:mysqld-bin.000014
马上到slave server执行
mysql> CHANGE MASTER TO MASTER_LOG_FILE=’mysqld-bin.000014′,MASTER_LOG_POS=107;
mysql> slave start;
mysql> show slave status\G;
主从恢复正常
注:CHANGE MASTER TO MASTER_LOG_FILE=’mysqld-bin.000014′,MASTER_LOG_POS=107;语句千万注意单引号前面不能有空格,否则也会主从同步失败,关闭selinux和iptables允许master、slave伺服器的ip访问.
本文转自 boy461205160 51CTO博客,原文链接:http://blog.51cto.com/461205160/1737725