从库出现问题

mysql> show slave status\G;
*************************** . row ***************************
Slave_IO_State:
Master_Host: 192.168.220.141
Master_User: rep
Master_Port:
Connect_Retry:
Master_Log_File: mysql-bin.000005 I/O线程当前正在读取的主服务器二进制日志文件的名称
Read_Master_Log_Pos: 764 在当前的主服务器二进制日志中,I/O线程已经读取的位置
Relay_Log_File: relay-bin.000018 SQL线程当前正在读取和执行的中继日志文件的名称
Relay_Log_Pos: 4 在当前的中继日志中,SQL线程已读取和执行的位置
Relay_Master_Log_File: mysql-bin.000005 由SQL线程执行的包含多数近期事件的主服务器二进制日志文件的名称
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 最后的错误号,0表示没有错误
Last_Error:                   最后错误的描述
Skip_Counter: 0 最近被使用的用于SQL_SLAVE_SKIP_COUNTER的值
Exec_Master_Log_Pos: 764 来自主服务器的二进制日志的由SQL线程执行的上一个时间的位置(Relay_Master_Log_File)。在主服务器的二进制日志中的(Relay_Master_Log_File,Exec_Master_Log_Pos)对应于在中继日志中的(Relay_Log_File,Relay_Log_Pos)
Relay_Log_Space: 107              所有原有的中继日志结合起来的总大小   
Until_Condition: None
Until_Log_File:
Until_Log_Pos:
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:
Last_SQL_Error:
Replicate_Ignore_Server_Ids:
Master_Server_Id:
row in set (0.00 sec) ERROR:
No query specified mysql>

查看mysql的错误日志

  大致的意思就是说,从库不能读取主库的binlog日志文件了,造成这种故障的原因可能是:

  1.     从库不能连接主库
  2.     主库的binlog日志被删除了

      .......

[root@mysql ~]# tail /data//mysql.err          //查看错误日志
:: [Note] Slave SQL thread initialized, starting replication in log 'mysql-bin.000005' at position , relay log '/data/3307/relay-bin.000018' position:
:: [ERROR] Error reading packet from server: Could not find first log file name in binary log index file ( server_errno=)
:: [ERROR] Slave I/O: Got fatal error from master when reading data from binary log: 'Could not find first log file name in binary log index file', Error_code:
:: [Note] Slave I/O thread exiting, read up to log 'mysql-bin.000005', position
[root@mysql ]# ping 192.168.220.141 //测试和主库的连通性
PING 192.168.220.141 (192.168.220.141) () bytes of data.
bytes from 192.168.220.141: icmp_seq= ttl= time=0.197 ms
bytes from 192.168.220.141: icmp_seq= ttl= time=0.029 ms
bytes from 192.168.220.141: icmp_seq= ttl= time=0.025 ms
^C
--- 192.168.220.141 ping statistics ---

查看主库的日志

Slave I/O thread exiting, read up to log 'mysql-bin.000005', position 764提示读取mysql-bin.000005错误,查看主库的binlog日志后发现没有mysql-bin.0000005日志文件
这是因为长时间没有开启数据库,binlog的存活时间是7天,所以binlog00000005日志应该是被删除了
规定binlog日志存活时间的参数在my.cnf中
expire_logs_days = 7 //单位是天,0表示不自动删除
[root@mysql ~]# ll /data//
total
drwxr-xr-x mysql mysql Nov : data
-rw-r--r-- mysql mysql Oct : my.cnf
-rwx------ root root Oct : mysql
-rw-rw---- mysql mysql Nov : mysql-bin.
-rw-rw---- mysql mysql Nov : mysql-bin.index
srwxrwxrwx mysql mysql Nov : mysql.sock
-rw-r----- mysql root Nov : mysql_oldboy3306.err
-rw-rw---- mysql mysql Nov : mysqld.pid
[root@mysql ~]#

调整从库的同步位置:

change master to master_log_file='mysql-bin.000006',master_log_pos=4
mysql> stop slave;
Query OK, rows affected (0.00 sec) mysql> change master to master_log_file='mysql-bin.000006',master_log_pos=4;
Query OK, rows affected (0.32 sec) mysql> start slave;
Query OK, rows affected (0.00 sec) mysql> show slave status\G;
*************************** . row ***************************
Slave_IO_State: Waiting for master to send event
Master_Host: 192.168.220.141
Master_User: rep
Master_Port:
Connect_Retry:
Master_Log_File: mysql-bin.
Read_Master_Log_Pos:
Relay_Log_File: relay-bin.
Relay_Log_Pos:
Relay_Master_Log_File: mysql-bin.
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:
Last_Error:
Skip_Counter:
Exec_Master_Log_Pos:
Relay_Log_Space:
Until_Condition: None
Until_Log_File:
Until_Log_Pos:
Master_SSL_Allowed: No
Master_SSL_CA_File:
Master_SSL_CA_Path:
Master_SSL_Cert:
Master_SSL_Cipher:
Master_SSL_Key:
Seconds_Behind_Master:
Master_SSL_Verify_Server_Cert: No
Last_IO_Errno: 0 //没有IO错误了
Last_IO_Error:
Last_SQL_Errno:
Last_SQL_Error:
Replicate_Ignore_Server_Ids:
Master_Server_Id:
row in set (0.00 sec) ERROR:
No query specified mysql>

MySQL1236错误的恢复的更多相关文章

  1. Openstack虚机实例状态错误手工恢复vm_state:error

    Openstack虚机实例状态错误手工恢复vm_state:error 1.找到状态为出错状态的VM.在数据库里面表现Status为ERROR而非ACTIVE. 2.找到出错状态VM的UUID. 3. ...

  2. MSSQL 2000 错误823恢复

    一.故障描述 MSSQL Server 2000 附加数据库错误823,附加数据库失败.数据库没有备份,不能通过备份恢复数据库,急需恢复数据库中的数据. 二.故障分析SQL Server数据库 823 ...

  3. MSSQL 2000 错误823恢复案例

    一.故障描述 MSSQL Server 2000 附加数据库错误823,附加数据库失败.数据库没有备份,不能通过备份恢复数据库,急需恢复数据库中的数据. 二.故障分析SQL Server数据库 823 ...

  4. HDFS 数据错误与恢复

  5. Gitlab-500错误的恢复

    一.问题截图 二.定位问题 2.1.查看状态 # 查看状态 gitlab-ctl status # 如图发现gitaly 是down的状态 2.2.查看日志 # 查看日志 gitlab-ctl tai ...

  6. Spring Boot 乐观锁加锁失败 - 使用AOP恢复错误

    之前写了一些辅助工作相关的Spring Boot怎么使用AOP.这里继续正题,怎么减少Spring Boot 乐观锁加锁报错的情况(基本可以解决). 1. 包依赖 spring-boot-starte ...

  7. HDFS 异常处理与恢复

    在前面的文章 <HDFS DataNode 设计实现解析>中我们对文件操作进行了描述,但并未展开讲述其中涉及的异常错误处理与恢复机制.本文将深入探讨 HDFS 文件操作涉及的错误处理与恢复 ...

  8. MySQL主从复制中常见的3个错误及填坑方案

    一.问题描述 主从复制错误一直是MySQL DBA一直填不完的坑,如鲠在喉,也有人说mysql主从复制不稳定云云,其实MySQL复制比我们想象中要坚强得多,而绝大部分DBA却认为只要跳过错误继续复制就 ...

  9. PHP基础之 错误处理 及 异常处理

    错误处理: 1.使用die()方法,结束语句的执行,并输出错误消息 2.自定义错误和错误触发器 自定义错误处理函数(系统有默认的错误处理函数,自定义的错误处理会覆盖默认的处理函数) ========= ...

随机推荐

  1. gRPC中Any类型的使用(Java和NodeJs端)

    工作中要把原来Java服务端基于SpringMVC的服务改为使用gRPC直接调用.由于原Service的返回值为动态的Map类型,key值不确定,且value的类型不唯一,因此使用了protobuf ...

  2. assign和weak的深层次解析

    我们知道在设置类的属性时,控件一般中weak,对象一般用strong,数据类型一般使用assign,其中weak和assign都不会使计数器增加,那为什对象不可以使用assign呢? weak与ass ...

  3. Java线程中yield()的用法

    Thread.yield()方法的作用:暂停当前正在执行的线程,并执行其他线程.(可能没有效果) yield()让当前正在运行的线程回到可运行状态,以允许具有相同优先级的其他线程获得运行的机会.因此, ...

  4. bootstrap 响应式工具

    <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8&quo ...

  5. HTML中三种定位relative,absolute,fixed后,盒子的百分比宽度及位置易错点

    1 . 相对定位relative:顾名思义,相对定位是相对于自己的位置来进行偏移,如下图: 以盒子中心为基准,为每条边的正方向,例: 向右移动20px : 代码为left:20px;或者right:- ...

  6. Unity编程标准导引-3.3 Transform

    本文为博主原创文章,欢迎转载.请保留博主链接http://blog.csdn.net/andrewfan 每个游戏对象(GameObject),其存在于游戏世界,都有一个位置.朝向.大小等基本定位信息 ...

  7. vs 2015常用快捷键

    原文 :http://www.23pro.com/post/4.html 1.回到上一个光标位置/前进到下一个光标位置 1)回到上一个光标位置:使用组合键"Ctrl + -"; 2 ...

  8. PB程序“无法启动此程序,因为计算机中丢失PBvm90.dll。尝试重新安装该程序以解决此问题”的解决方法

    因为有计算机自考科目,要求使用PB程序做一个管理系统.昨天刚安装好了PB程序,今天使用的时候,当我打开一个PB程序时,出现了"无法启动此程序,因为计算机中丢失PBvm90.dll.尝试重新安 ...

  9. ORACLE-EXP和IMP方法介绍

    说明: 之前经常有人询问数据库导出导入的方法,去百度查询,但是查询的结果却不是很尽如人意,所以在此做个基本的总结,包括 导出:(导出用户,导出表,导出表结构不带数据,QUERY参数),导入(导入数据文 ...

  10. Ansible 系列之 Ad-Hoc介绍及使用

    Ad-Hoc 介绍 一.什么是ad-hoc 命令? ad-hoc 命令是一种可以快速输入的命令,而且不需要保存起来的命令.就相当于bash中的一句话shell.这也是一个好的地方,在学习ansible ...