首页
学习
活动
专区
工具
TVP
发布
社区首页 >专栏 >MySQL主从报错解决:Failed to initialize the master info structure

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

作者头像
张戈
发布2018-03-21 15:12:14
1.2K0
发布2018-03-21 15:12:14
举报
文章被收录于专栏:张戈的专栏张戈的专栏

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

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

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

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

①、执行 reset slave;

②、重新执行 change master:

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 日志:

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

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

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

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

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

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

./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 再走一遍上面的三个步骤应该可以搞定了!

本文参与 腾讯云自媒体分享计划,分享自作者个人站点/博客。
原始发表:2016年03月29日,如有侵权请联系 cloudcommunity@tencent.com 删除

本文分享自 作者个人站点/博客 前往查看

如有侵权,请联系 cloudcommunity@tencent.com 删除。

本文参与 腾讯云自媒体分享计划  ,欢迎热爱写作的你一起参与!

评论
登录后参与评论
0 条评论
热度
最新
推荐阅读
相关产品与服务
云数据库 SQL Server
腾讯云数据库 SQL Server (TencentDB for SQL Server)是业界最常用的商用数据库之一,对基于 Windows 架构的应用程序具有完美的支持。TencentDB for SQL Server 拥有微软正版授权,可持续为用户提供最新的功能,避免未授权使用软件的风险。具有即开即用、稳定可靠、安全运行、弹性扩缩等特点。
领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档