博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
mysql报1236错误解决方法
阅读量:7198 次
发布时间:2019-06-29

本文共 3050 字,大约阅读时间需要 10 分钟。

mysql slave状态如下,发现IO线程为NO状态,并且报1236错误代码

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
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
mysql> show slave status\G
*************************** 1. row ***************************
               
Slave_IO_State: 
                  
Master_Host: 10.0.0.20
                  
Master_User: rep
                  
Master_Port: 3307
                
Connect_Retry: 60
              
Master_Log_File: mysql-bin.000001
          
Read_Master_Log_Pos: 4
               
Relay_Log_File: relay-bin.000001
                
Relay_Log_Pos: 4
        
Relay_Master_Log_File: mysql-bin.000001
             
Slave_IO_Running: 
No
            
Slave_SQL_Running: Yes
              
Replicate_Do_DB: 
          
Replicate_Ignore_DB: mysql
           
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: 4
              
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: 3
1 row 
in 
set 
(0.00 sec)

解决办法

登陆master端做以下操作,并记录File_zize对应的值107

1
2
3
4
5
6
7
8
9
mysql> reset master;
Query OK, 0 
rows 
affected (0.11 sec)
mysql> show master logs;
+
------------------+-----------+
| Log_name         | File_size |
+
------------------+-----------+
| mysql-bin.000001 |       107 |
+
------------------+-----------+
1 row 
in 
set 
(0.00 sec)

登陆slave端做一下操作,master_log_pos的值设置为107

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
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
mysql> stop slave;
Query OK, 0 
rows 
affected (0.00 sec)
mysql> change master 
to 
master_log_pos=107;
Query OK, 0 
rows 
affected (0.11 sec)
mysql> start slave;
Query OK, 0 
rows 
affected (0.00 sec)
mysql> show slave status\G
*************************** 1. row ***************************
               
Slave_IO_State: Waiting 
for 
master 
to 
send event
                  
Master_Host: 10.0.0.20
                  
Master_User: rep
                  
Master_Port: 3307
                
Connect_Retry: 60
              
Master_Log_File: mysql-bin.000001
          
Read_Master_Log_Pos: 107
               
Relay_Log_File: relay-bin.000002
                
Relay_Log_Pos: 253
        
Relay_Master_Log_File: mysql-bin.000001
             
Slave_IO_Running: Yes
            
Slave_SQL_Running: Yes
              
Replicate_Do_DB: 
          
Replicate_Ignore_DB: mysql
           
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: 403
              
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: 0
Master_SSL_Verify_Server_Cert: 
No
                
Last_IO_Errno: 0
                
Last_IO_Error: 
               
Last_SQL_Errno: 0
               
Last_SQL_Error: 
  
Replicate_Ignore_Server_Ids: 
             
Master_Server_Id: 3
1 row 
in 
set 
(0.00 sec)

最后主从同步恢复了正常^_^

本文转自 茁壮的小草 51CTO博客,原文链接:http://blog.51cto.com/wn2100/1954164,如需转载请自行联系原作者

你可能感兴趣的文章
ios-网址中的中文或者非法字符转换
查看>>
自定义通知与系统通知的学习(详解)
查看>>
我的程序员之路(一)
查看>>
Spring思维导图,让Spring不再难懂(ioc篇)
查看>>
JVM调优之:内存分配参数
查看>>
webpack CSS LESS
查看>>
设计模式——模板方法模式
查看>>
eqweqe23
查看>>
面向对象
查看>>
javascript 添加事件兼容性处理
查看>>
Linux 目录卡死
查看>>
微服务框架Spring Cloud之使用事件和消息队列实现分布式事务
查看>>
碉堡了Ubuntu Core Linux支持 TS-4900 物联网开发板
查看>>
如何在多Kubernetes集群和多租户环境中使用Prometheus监控
查看>>
Thymeleaf教程 (十) 属性的优先级列表
查看>>
linux中 vi / vim显示行号或取消行号命令
查看>>
Python学习笔记 - 02: 用Python Client连接ElasticSearch操作数据
查看>>
2018年前端开发回顾
查看>>
微信小程序访问webService(Java)
查看>>
QT从QObject实现多重继承
查看>>