MySQL1236错误的恢复
从库出现问题
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日志文件了,造成这种故障的原因可能是:
- 从库不能连接主库
- 主库的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错误的恢复的更多相关文章
- Openstack虚机实例状态错误手工恢复vm_state:error
Openstack虚机实例状态错误手工恢复vm_state:error 1.找到状态为出错状态的VM.在数据库里面表现Status为ERROR而非ACTIVE. 2.找到出错状态VM的UUID. 3. ...
- MSSQL 2000 错误823恢复
一.故障描述 MSSQL Server 2000 附加数据库错误823,附加数据库失败.数据库没有备份,不能通过备份恢复数据库,急需恢复数据库中的数据. 二.故障分析SQL Server数据库 823 ...
- MSSQL 2000 错误823恢复案例
一.故障描述 MSSQL Server 2000 附加数据库错误823,附加数据库失败.数据库没有备份,不能通过备份恢复数据库,急需恢复数据库中的数据. 二.故障分析SQL Server数据库 823 ...
- HDFS 数据错误与恢复
- Gitlab-500错误的恢复
一.问题截图 二.定位问题 2.1.查看状态 # 查看状态 gitlab-ctl status # 如图发现gitaly 是down的状态 2.2.查看日志 # 查看日志 gitlab-ctl tai ...
- Spring Boot 乐观锁加锁失败 - 使用AOP恢复错误
之前写了一些辅助工作相关的Spring Boot怎么使用AOP.这里继续正题,怎么减少Spring Boot 乐观锁加锁报错的情况(基本可以解决). 1. 包依赖 spring-boot-starte ...
- HDFS 异常处理与恢复
在前面的文章 <HDFS DataNode 设计实现解析>中我们对文件操作进行了描述,但并未展开讲述其中涉及的异常错误处理与恢复机制.本文将深入探讨 HDFS 文件操作涉及的错误处理与恢复 ...
- MySQL主从复制中常见的3个错误及填坑方案
一.问题描述 主从复制错误一直是MySQL DBA一直填不完的坑,如鲠在喉,也有人说mysql主从复制不稳定云云,其实MySQL复制比我们想象中要坚强得多,而绝大部分DBA却认为只要跳过错误继续复制就 ...
- PHP基础之 错误处理 及 异常处理
错误处理: 1.使用die()方法,结束语句的执行,并输出错误消息 2.自定义错误和错误触发器 自定义错误处理函数(系统有默认的错误处理函数,自定义的错误处理会覆盖默认的处理函数) ========= ...
随机推荐
- [MongoDB] - Window7下安装及BSON基本介绍
MongoDB是一种NOSQL(Not Only SQL)类型的文档型数据库.NoSQL数据库与传统的关系型数据库相比,它具有操作简单.完全免费.源码公开.随时下载等特点,并可以用于各种商业目的.Mo ...
- masm32V11配置
本文写给学汇编语言程序设计刚起步的吧友.适用Windows操作系统.已入门的吧友请绕道. (1)masm32开发包的下载 要用汇编语言编程,首先得有个开发工具,汇编语言开发工具有多种,但本文仅介绍ma ...
- SCP实现无需密码传输文件
SCP概述 Linux为我们提供了两个用于文件copy的命令,一个是cp,一个是scp,但是他们略有不同 CP ----- 主要是用于在同一台电脑上,在不同的目录之间来回copy文件 SCP --- ...
- BZOJ 3432: [Usaco2014 Jan]Cross Country Skiing (二分+染色法)
还是搜索~~可以看出随着D值的增大能到达的点越多,就2分d值+染色法遍历就行啦~~~ CODE: #include<cstdio>#include<iostream>#incl ...
- vmware安装黑苹果教程
1.下载最新版vmware http://pan.baidu.com/s/1pLD8wxt 秘钥:UY192-0DW12-M81XY-DWW7C-MCKU6 2.确保hyper-v功能已关闭 3.下载 ...
- 走进javascript——不起眼的基础,值和分号
值 有时我很想知道javascript解析引擎是如何区分一个变量的值,比如下面这段代码. var x = 'javascript'; //javascript x = "hello" ...
- Ansible详解(一)
简介 Ansible是一个简单的自动化运维管理工具,基于Python语言实现,由Paramiko和PyYAML两个关键模块构建,可用于自动化部署应用.配置.编排task(持续交付.无宕机更新等).主版 ...
- poj 2236
Wireless Network Time Limit: 10000MS Memory Limit: 65536K Total Submissions: 25817 Accepted: 107 ...
- Unity3D换装系统
转载请注明出处:http://www.cnblogs.com/shamoyuu/p/6505561.html 一.换装原理 游戏角色换装分为以下几步: 1.替换蒙皮网格 2.刷新骨骼 3.替换材质 上 ...
- ROJ 1166 超级贞鱼
1166: 超级贞鱼 Time Limit: 1 Sec Memory Limit: 128 MB [Submit][Status] 传送门 Description 马达加斯加贞鱼是一种神奇的双脚贞 ...