MySQL主从报错解决:Failed to initialize the master info structure

大清早收到一个MySQL的自定义语言告警 :replication interrupt,看来是主从同步报错了。

登陆MySQL,执行 show slave status \G 发现salve已经停止了,于是使用 start slave启动,结果有如下报错:

1

ERROR 1201 (HY000): Could not initialize master info structure; more error messages can be found in the MySQL error log

搜索了下,网上给出的解决办法基本都是:

①、执行 reset slave;

②、重新执行 change master:

1

2

3

4

5

6

7

mysql> change master to

-> master_host=‘192.168.1.100‘,

-> master_port=3306,

-> master_user=‘repl‘,

-> master_password=‘repl‘,

-> master_log_file=‘mysql-bin.000051‘,

-> master_log_pos=254105;

③、执行 start slave

于是试了下,发现还是一样的报错,顺着报错信息,看了下error 日志:

1

2

3

4

5

6

7

8

9

10

11

12

13

14

160324  6:40:10 [ERROR] log *** glibc detected *** /data/mysql/bin/mysqld: corrupted double-linked list: 0x00002ab038100ab0 *** listed in the index, but failed to stat

160324  6:40:10 [ERROR] Error counting relay log space

160324  6:40:10 [ERROR] Failed to initialize the master info structure

160324  6:40:10 [Note] Event Scheduler: Loaded 0 events

160324  6:40:10 [Note] /data/mysql/bin/mysqld: ready for connections.

Version: ‘5.5.13-log‘  socket: ‘/data/mysql/data/mysqld.sock‘  port: 3306  Source distribution

160324  9:33:41 [ERROR] log *** glibc detected *** /data/mysql/bin/mysqld: corrupted double-linked list: 0x00002ab038100ab0 *** listed in the index, but failed to stat

160324  9:33:41 [ERROR] Error counting relay log space

160324  9:33:54 [ERROR] log *** glibc detected *** /data/mysql/bin/mysqld: corrupted double-linked list: 0x00002ab038100ab0 *** listed in the index, but failed to stat

160324  9:33:54 [ERROR] Error counting relay log space

160324  9:35:29 [ERROR] log *** glibc detected *** /data/mysql/bin/mysqld: corrupted double-linked list: 0x00002ab038100ab0 *** listed in the index, but failed to stat

160324  9:35:29 [ERROR] Error counting relay log space

160324  9:37:47 [ERROR] log *** glibc detected *** /data/mysql/bin/mysqld: corrupted double-linked list: 0x00002ab038100ab0 *** listed in the index, but failed to stat

160324  9:37:47 [ERROR] Error counting relay log space

发现其中频繁出现如下错误:

1

ist: 0x00002ab038100ab0 *** listed in the index, but failed to stat

于是,把MySQL 数据文件目录下的 index info 文件都看了一遍,结果发现 Centos64-relay-bin.index文件中出现异常内容:

这个文件正常情况应该是记录了 bin-log文件名称才对,比如:

1

2

3

4

5

6

7

./Centos64-relay-bin.002064

./Centos64-relay-bin.002065

./Centos64-relay-bin.002066

./Centos64-relay-bin.002067

./Centos64-relay-bin.002068

./Centos64-relay-bin.002069

./Centos64-relay-bin.002070

因此,将 Centos64-relay-bin.index 这个文件mv 重命名,然后重启MySQL,重新按照上文从网上照来的的步骤:reset、change master、start 成功搞定!

如果你也遇到类似问题,可以先按照网上提供的三个步骤试试,如果还是和本文类似的报错,请特别看下MySQL数据目录下的这几种文件:

mysql-bin.index

relay-log.info

主机名-relay-bin.index

可以尝试将他们重命名或移走,重启MySQL再走一遍上面的三个步骤应该可以搞定了!

关注流行国外网站

facebook:http://www.fb-on.com

facebook官网:http://www.facebookzh.com

facebook:http://www.cn-face-book.com

facebook:http://www.vivcall.com

youtube:http://www.youtubezh.com

twitter:http://www.twitterzh.com

时间: 2024-10-11 14:06:52

MySQL主从报错解决:Failed to initialize the master info structure的相关文章

PHP多次调用Mysql存储过程报错解决办法

PHP多次调用Mysql数据库的存储过程会出现问题,主要问题为存储过程中执行多次SQL语句不能一一释放导致的,网上找了一些解决办法,比如使用 multi_query 然后一个一个释放,但是发现根本不适合我们的项目,我们使用CI框架写的,更多的是使用CI的数据库处理方法.所以只能另辟蹊径. 一次偶然,把Mysql链接方式改成了mysqli,两种不同的PHP连接mysql的扩展,官方在高版本中推荐使用mysqli,结果却奇迹般好了,使用Mysql长连接也行,天意么? PHP多次调用Mysql存储过程

MySQL主从报错1594

一.主从报错 Relay log read failure 问题原因,MySQL主从使用的是kvm虚拟机,物理机超分严重,在负载高的情况下会kill掉占用资源最多的虚拟机,再启动后导致主从失败 mysql> show slave status\G *************************** 1. row *************************** Slave_IO_State: Waiting for master to send event Master_Host: 1

解决sever 2008中tomcat的报错 init Failed to initialize end point associated with ProtocolHandler ["http-nio-80"]

错误现象: 01-Aug-2017 14:59:50.140 信息 [main] org.apache.coyote.AbstractProtocol.init Initializing ProtocolHandler ["http-nio-80"]01-Aug-2017 14:59:50.182 严重 [main] org.apache.coyote.AbstractProtocol.init Failed to initialize end point associated wit

mysql启动报错解决-3

场景还原: 初始化 #/usr/local/webserver/mysql/bin/mysql_install_db --user=mysql --basedir=/usr/local/webserver/mysql/ --datadir=/home/mysqldata Installing MySQL system tables...150205 11:48:00 [Note] Flashcache bypass: disabled150205 11:48:00 [Note] Flashcac

mysql主从报错截图

1.首先确认报错的binlog和last event. 2.然后去主的机器上查看该报错的内容和报错的的位置,如果是结尾报错的,可以直接从新的binlog进行同步. #/mysql/logs# ../bin/mysqlbinlog  --start-position=506063695 mysql-bin.000159 | less 3.看到报错是该文件的最后一个值(binlog异常关闭引起),可以直接在从上定义同步起始点,进行同步. mysql> change master to master_

mysql启动报错解决-2

场景还原: 初始化 #/usr/local/webserver/mysql/bin/mysql_install_db --user=mysql --basedir=/usr/local/webserver/mysql/ --datadir=/home/mysqldata Installing MySQL system tables...150205 11:48:00 [Note] Flashcache bypass: disabled150205 11:48:00 [Note] Flashcac

Mysql安装报错解决办法

.msi版MySQL安装包在安装最后执行的时候到第三部或者第四部死掉 主要是因为之前安装的版本没有卸载干净,要卸载干净MySQ安装包有一些几个步骤: 1.通过卸载程序MySQL的相关组件 2.删除Mysql的安装目录 3.在注册表(regedit)查询mysql,全部删除 cmd->regedit 1.HKEY_LOCAL_MACHINE\SYSTEM\ControlSet001\Services\Eventlog\Application\MySQL 目录 2.HKEY_LOCAL_MACHIN

mysql安装报错解决一例

错误日志: [[email protected] scripts]# tail /var/log/mysqld.log InnoDB: Apply batch completed 2014-12-08 11:01:37 15721 [Note] InnoDB: 128 rollback segment(s) are active. 2014-12-08 11:01:37 15721 [Note] InnoDB: Waiting for purge to start 2014-12-08 11:0

【故障处理】ERROR 1872 (HY000): Slave failed to initialize relay log info structure from the repository

今天在使用冷备份文件重做从库时遇到一个报错,值得研究一下. 版本:MySQL5.6.27 一.报错现象 dba:(none)> start slave; ERROR 1872 (HY000): Slave failed to initialize relay log info structure from the repository 这个时候查看error.log: 2017-07-17 16:19:02 9022 [ERROR] Failed to open the relay log '.