从库出现问题

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. Ubuntu纯字符界面的一些设置

    由于Ubuntu的纯字符界面不支持中文显示,所以进行了一些配置,为了更好的显示 1. 把环境语言配置为英文 在用户目录下的".bashrc"文件的结尾处添加以下内容,然后重新登录 ...

  2. 使用ViewPagerAdapter 页面引导适配器设置app启动页,引导页面的实现

    一般的app第一次安装启动的时候,都会有一个启动页面和引导页的画面,然后才进入主程序.anndroid中的ViewPagerAdapter 是一个继承与PageAdapter的 页面引导适配器.由于我 ...

  3. 【翻译】Jay Kreps - 为何流处理中局部状态是必要的

    译者注: 原文作者是 Jay Kreps,也是那篇著名的<The Log: What every software engineer should know about real-time da ...

  4. 剖析Asp.Net Web API中HttpController的激活

    在Asp.Net Web API中,请求的目标是定义在某个HttpController中的某个Action方法.当请求经过Asp.Net Web API消息处理管道到达管道"龙尾" ...

  5. Linux下软件设成系统服务运行

    将软件的启动脚本copy到/etc/init.d/soft_name             chmod 777 soft_name   设置服务开机启动   chkconfig soft_name ...

  6. Python之路--你不知道的platform

    某次在查看测试机(Ubuntu)发行版本时,发现得到的结果并不准确:本应得到Ubuntu,结果显示的却是Debian,大致代码如下 ... distribution_name = ['centos', ...

  7. noi 1.8 11图像旋转

    水题不解释 其实我偷懒了 直接输出,,,,,,, 个人QQ:757394026团队QQ:466373640个人博客:www.doubleq.winc++/noi/信息学奥数博客:http://www. ...

  8. 精通gulp常用插件

    本文主要展示的是gulp常用插件的使用方法和用途,通过对插件的熟练运用达到精通gulp.不定期更新.可以到github上面下载DEMO. github地址:lin-xin/gulp-plugins 匹 ...

  9. 《Django By Example》第七章 中文 翻译 (个人学习,渣翻)

    书籍出处:https://www.packtpub.com/web-development/django-example 原作者:Antonio Melé (译者@ucag注:咳咳,第七章终于来了.其 ...

  10. markdown中常见的转义字符

    markdown中的转义字符 字符 转义后字符 & & " " > > < < 不断空格   \ \\ ` \` * \* _ \_ {} ...