从库出现问题

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. Java List集合特有方法程序用法

    package Collection; /* Collection |--List:元素是有序的,元素可以重复.因为该集合体系有索引 | |--ArrayList:底层的数据结构使用的是数组结构 特点 ...

  2. MINIDVD

    import java.util.*; public class MiniDVD { public static void main(String[] args){ //扫描器 Scanner inp ...

  3. 无需Get更多技能,快速打造一个可持久化的任务调度

    项目总是很忙,忙里偷闲还是要总结一下,前一段时间,由于项目中需要,我们需要很多定时汇总数据的情况,项目初期主要使用sql server 计划任务实现对数据的汇总与统计,但是开发到一定时间内,需求提出了 ...

  4. 微信公众平台开发-微信服务器IP接口实例(含源码)

    微信公众平台开发-access_token获取及应用(含源码)作者: 孟祥磊-<微信公众平台开发实例教程> 学习了access_token的获取及应用后,正式的使用access_token ...

  5. 基于fiddler的APP抓包及服务端模拟

    在HTTP接口的测试过程中,一般我们会按照如下的步骤进行: 1)测试环境的准备 2)HTTP消息体的构造 3)HTTP消息的发送及断言 如果我们可以拿到项目组的接口文档,并且HTTP后台服务是可以工作 ...

  6. v3学院带您一起学习FPGA

    本文为原创,转载请注明! 课程名称:双buffer乒乓操作项目概况:使用FPGA内部ram作为缓冲器,实现对外部数据流的缓存:为了提升数据的传输及处理速度,在此节课中将用到两个ram进行乒乓操作.结构 ...

  7. visibility: hidden和 display: none的区别

    visibility: hidden----将元素隐藏,但是在网页中该占的位置还是占着. display: none----将元素的显示设为无,即在网页中不占任何的位置.

  8. Laptop Ubuntu16.04/14.04 安装Nvidia显卡驱动

    笔记本型号 机械革命(MECHREVO)深海泰坦X6Ti-S(黑曜金)15.6英寸 CPU型号 i5-7300HQ 内存 8G 硬盘容量 128SSD+1T机械硬盘 显卡 GeForce GTX 10 ...

  9. 从覆盖bootstrap样式谈css选择器优先级

    样式优先级 首先简单说几个定义样式的方式: 元素内嵌: <li><a href="" style="color:#ffffff;">SH ...

  10. 1820: [JSOI2010]Express Service 快递服务

    1820: [JSOI2010]Express Service 快递服务 Time Limit: 10 Sec  Memory Limit: 64 MBSubmit: 847  Solved: 325 ...