Discuz! Board

 找回密码
 立即注册
搜索
热搜: 活动 交友 discuz
查看: 504|回复: 0
打印 上一主题 下一主题

Moretv-Computing3-1数据库主从状态不稳定解决办法

[复制链接]

85

主题

89

帖子

600

积分

管理员

Rank: 9Rank: 9Rank: 9

积分
600
跳转到指定楼层
楼主
发表于 2015-10-27 11:42:17 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
1、杭州机房Moretv-Computing3-1数据库主从状态频繁出现Slave_IO_Running: Connecting.查看error日志有如下大量报错:151027 11:31:29 [Note] Slave I/O thread: Failed reading log event, reconnecting to retry, log 'mysql-bin.000381' at position 381145669
151027 11:31:29 [Note] Slave: received end packet from server, apparent master shutdown:

2、经过排查发现Moretv-Computing3-1(101.59.54.222)和BJUC-java-tomcat-vod-12(123.59.60.108)从库的server_id相同,并且BJUC-java-tomcat-vod-12上的error日志同样出现大量报错:
151027 11:31:23 [Note] Slave I/O thread: Failed reading log event, reconnecting to retry, log 'mysql-bin.000381' at position 381145669
151027 11:31:24 [Note] Slave: received end packet from server, apparent master shutdown:

3、修改Moretv-Computing3-1的server_id:
mysql> set global server_id=212;
Query OK, 0 rows affected (0.00 sec)

mysql> show variables like 'server_id';
+---------------+-------+
| Variable_name | Value |
+---------------+-------+
| server_id     | 212   |
+---------------+-------+
1 row in set (0.00 sec)

mysql> stop slave;
Query OK, 0 rows affected (0.02 sec)

mysql> start slave;
Query OK, 0 rows affected (0.00 sec)


4、show slave status\G不再出现Slave_IO_Running: Connecting。error日志正常。BJUC-java-tomcat-vod-12上日志也正常。
5、至此数据库故障解决,建议今后做数据库主从时确认好server_id。

回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

Archiver|手机版|小黑屋|Comsenz Inc.

GMT+8, 2024-12-15 22:37 , Processed in 0.033025 second(s), 23 queries .

Powered by Discuz! X3.2

© 2001-2013 Comsenz Inc.

快速回复 返回顶部 返回列表