报错处理

刚处理完“挖矿”事件,在做最后3个MySQL
NBU备份的时候,发现从库有难点,好奇的是怎么主从状态相当未有报告警察方呢?先不管这么多了,处理了那几个难点再完善告警内容。

年后再次来到查看mysql运转情况与备份情况,登录mysql从库查看主从同步状态

年后赶回查看mysql运转境况与备份景况,登录mysql从库查看主从同步状态

mysql从库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’报错处理,gotfatalerror123陆

年后重临查看mysql运维情状与备份情状,登录mysql从库查看主从同步状态

 1 mysql> show slave status\G;
 2 *************************** 1. row ***************************
 3                Slave_IO_State: 
 4                   Master_Host: 101.200.*.*
 5                   Master_User: backup
 6                   Master_Port: 3306
 7                 Connect_Retry: 60
 8               Master_Log_File: master-bin.000113
 9           Read_Master_Log_Pos: 276925387
10                Relay_Log_File: mysql-relay.000001
11                 Relay_Log_Pos: 4
12         Relay_Master_Log_File: master-bin.000113
13              Slave_IO_Running: No
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: 276925387
25               Relay_Log_Space: 120
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: NULL
36 Master_SSL_Verify_Server_Cert: No
37                 Last_IO_Errno: 1236
38                 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'
39                Last_SQL_Errno: 0
40                Last_SQL_Error: 
41   Replicate_Ignore_Server_Ids: 
42              Master_Server_Id: 21
43                   Master_UUID: e4a43da7-5b58-11e5-a12f-00163e003632
44              Master_Info_File: /home/data/mysql/master.info
45                     SQL_Delay: 0
46           SQL_Remaining_Delay: NULL
47       Slave_SQL_Running_State: Slave has read all relay log; waiting for the slave I/O thread to update it
48            Master_Retry_Count: 86400
49                   Master_Bind: 
50       Last_IO_Error_Timestamp: 170204 10:48:06
51      Last_SQL_Error_Timestamp: 
52                Master_SSL_Crl: 
53            Master_SSL_Crlpath: 
54            Retrieved_Gtid_Set: 
55             Executed_Gtid_Set: 
56                 Auto_Position: 0
57 1 row in set (0.00 sec)
58 
59 ERROR: 
60 No query specified

突然之间Slave_IO_Running: 状态成为NO了

 

焚林而猎措施。

先是在从库上进行

stop slave;

 

查看主库master状态

 1 mysql> show master status\G;
 2 *************************** 1. row ***************************
 3              File: mysql-bin.000113
 4          Position: 276925387
 5      Binlog_Do_DB: 
 6  Binlog_Ignore_DB: 
 7 Executed_Gtid_Set: 
 8 1 row in set (0.00 sec)
 9 
10 ERROR: 
11 No query specified
12 
13 mysql> flush logs;
14 Query OK, 0 rows affected (0.11 sec)

刷新binlog日志

报错处理。flush logs;

刷新后的日志会+1

诸如地点的 File: mysql-bin.000113 会成为 File: mysql-bin.00011四

再也翻开master状态

 1 mysql> show master status\G;
 2 *************************** 1. row ***************************
 3              File: mysql-bin.000114
 4          Position: 120
 5      Binlog_Do_DB: 
 6  Binlog_Ignore_DB: 
 7 Executed_Gtid_Set: 
 8 1 row in set (0.00 sec)
 9 
10 ERROR: 
11 No query specified

接下来就不供给在操作master,切换来从库

输入CHANGE MASTER TO
MASTER_LOG_FILE=’mysql-bin.000114′,MASTER_LOG_POS=120;

执行start slave;

翻看从库状态

 1 mysql> show slave status\G;
 2 *************************** 1. row ***************************
 3                Slave_IO_State: Waiting for master to send event
 4                   Master_Host: 101.200.*.*
 5                   Master_User: backup
 6                   Master_Port: 3306
 7                 Connect_Retry: 60
 8               Master_Log_File: mysql-bin.000114
 9           Read_Master_Log_Pos: 11314
10                Relay_Log_File: mysql-relay.000002
11                 Relay_Log_Pos: 11477
12         Relay_Master_Log_File: mysql-bin.000114
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: 11314
25               Relay_Log_Space: 11646
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: 21
43                   Master_UUID: e4a43da7-5b58-11e5-a12f-00163e003632
44              Master_Info_File: /home/data/mysql/master.info
45                     SQL_Delay: 0
46           SQL_Remaining_Delay: NULL
47       Slave_SQL_Running_State: Slave has read all relay log; waiting for the slave I/O thread to update it
48            Master_Retry_Count: 86400
49                   Master_Bind: 
50       Last_IO_Error_Timestamp: 
51      Last_SQL_Error_Timestamp: 
52                Master_SSL_Crl: 
53            Master_SSL_Crlpath: 
54            Retrieved_Gtid_Set: 
55             Executed_Gtid_Set: 
56                 Auto_Position: 0
57 1 row in set (0.00 sec)
58 
59 ERROR: 
60 No query specified

 

: Got fatal error 1236from master when reading data from binary log: Could not find first log
file name in binary log index file报错处理,gotfatalerro…

①、错误新闻

 1 mysql> show slave status\G;
 2 *************************** 1. row ***************************
 3                Slave_IO_State: 
 4                   Master_Host: 101.200.*.*
 5                   Master_User: backup
 6                   Master_Port: 3306
 7                 Connect_Retry: 60
 8               Master_Log_File: master-bin.000113
 9           Read_Master_Log_Pos: 276925387
10                Relay_Log_File: mysql-relay.000001
11                 Relay_Log_Pos: 4
12         Relay_Master_Log_File: master-bin.000113
13              Slave_IO_Running: No
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: 276925387
25               Relay_Log_Space: 120
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: NULL
36 Master_SSL_Verify_Server_Cert: No
37                 Last_IO_Errno: 1236
38                 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'
39                Last_SQL_Errno: 0
40                Last_SQL_Error: 
41   Replicate_Ignore_Server_Ids: 
42              Master_Server_Id: 21
43                   Master_UUID: e4a43da7-5b58-11e5-a12f-00163e003632
44              Master_Info_File: /home/data/mysql/master.info
45                     SQL_Delay: 0
46           SQL_Remaining_Delay: NULL
47       Slave_SQL_Running_State: Slave has read all relay log; waiting for the slave I/O thread to update it
48            Master_Retry_Count: 86400
49                   Master_Bind: 
50       Last_IO_Error_Timestamp: 170204 10:48:06
51      Last_SQL_Error_Timestamp: 
52                Master_SSL_Crl: 
53            Master_SSL_Crlpath: 
54            Retrieved_Gtid_Set: 
55             Executed_Gtid_Set: 
56                 Auto_Position: 0
57 1 row in set (0.00 sec)
58 
59 ERROR: 
60 No query specified
 1 mysql> show slave status\G;
 2 *************************** 1. row ***************************
 3                Slave_IO_State: 
 4                   Master_Host: 101.200.*.*
 5                   Master_User: backup
 6                   Master_Port: 3306
 7                 Connect_Retry: 60
 8               Master_Log_File: master-bin.000113
 9           Read_Master_Log_Pos: 276925387
10                Relay_Log_File: mysql-relay.000001
11                 Relay_Log_Pos: 4
12         Relay_Master_Log_File: master-bin.000113
13              Slave_IO_Running: No
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: 276925387
25               Relay_Log_Space: 120
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: NULL
36 Master_SSL_Verify_Server_Cert: No
37                 Last_IO_Errno: 1236
38                 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'
39                Last_SQL_Errno: 0
40                Last_SQL_Error: 
41   Replicate_Ignore_Server_Ids: 
42              Master_Server_Id: 21
43                   Master_UUID: e4a43da7-5b58-11e5-a12f-00163e003632
44              Master_Info_File: /home/data/mysql/master.info
45                     SQL_Delay: 0
46           SQL_Remaining_Delay: NULL
47       Slave_SQL_Running_State: Slave has read all relay log; waiting for the slave I/O thread to update it
48            Master_Retry_Count: 86400
49                   Master_Bind: 
50       Last_IO_Error_Timestamp: 170204 10:48:06
51      Last_SQL_Error_Timestamp: 
52                Master_SSL_Crl: 
53            Master_SSL_Crlpath: 
54            Retrieved_Gtid_Set: 
55             Executed_Gtid_Set: 
56                 Auto_Position: 0
57 1 row in set (0.00 sec)
58 
59 ERROR: 
60 No query specified

从库show slave status \G看到的错误音信如下:

爆冷门之间Slave_IO_Running: 状态变成NO了

蓦然之间Slave_IO_Running: 状态变成NO了

Slave_IO_Running: No
Slave_SQL_Running: Yes
Last_IO_Errno: 1236
Last_IO_Error: Got fatal error 1236 from master when reading data from binary log: 'Client requested master to start replication from impossible position; the first event 'mysql-bin.000081' at 480141113, the last event read from './mysql-bin.000081' at 4, the last byte read from './mysql-bin.000081' at 4.'

 

 

二、错误原因

解决方法。

不留余地办法。

此处看看从库的io_thread已经告壹段落,错误编号是1236,具体是出于读取主库的binlog日志地方(the first event ‘mysql-bin.0000八一’ at 48014111三, the
last event read from ‘./mysql-bin.0000八壹’ at
四)不对导致基本战败建立失利。

先是在从库上举行

率先在从库上执行

3、化解方案

stop slave;

stop slave;

一.反省从库状态以及读取、执行的binlog音信

 

 

mysql> show slave status \G
*************************** 1. row ***************************
               Slave_IO_State: 
                  Master_Host: xx.xx.xx.xx
                  Master_User: username
                  Master_Port: 3306
                Connect_Retry: 60
              Master_Log_File: mysql-bin.000081
          Read_Master_Log_Pos: 480141113
               Relay_Log_File: mysql9017-relay-bin.000163
                Relay_Log_Pos: 480141259
        Relay_Master_Log_File: mysql-bin.000081
             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: 480141113
              Relay_Log_Space: 480141462
              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: 'Client requested master to start replication from impossible position; the first event 'mysql-bin.000081' at 480141113, the last event read from './mysql-bin.000081' at 4, the last byte read from './mysql-bin.000081' at 4.'
               Last_SQL_Errno: 0
               Last_SQL_Error: 
  Replicate_Ignore_Server_Ids: 
             Master_Server_Id: 17
1 row in set (0.00 sec)

翻看主库master状态

查看主库master状态

二.翻看主库的binlog内容

 1 mysql> show master status\G;
 2 *************************** 1. row ***************************
 3              File: mysql-bin.000113
 4          Position: 276925387
 5      Binlog_Do_DB: 
 6  Binlog_Ignore_DB: 
 7 Executed_Gtid_Set: 
 8 1 row in set (0.00 sec)
 9 
10 ERROR: 
11 No query specified
12 
13 mysql> flush logs;
14 Query OK, 0 rows affected (0.11 sec)
 1 mysql> show master status\G;
 2 *************************** 1. row ***************************
 3              File: mysql-bin.000113
 4          Position: 276925387
 5      Binlog_Do_DB: 
 6  Binlog_Ignore_DB: 
 7 Executed_Gtid_Set: 
 8 1 row in set (0.00 sec)
 9 
10 ERROR: 
11 No query specified
12 
13 mysql> flush logs;
14 Query OK, 0 rows affected (0.11 sec)
admin

网站地图xml地图