从从快照进行主从故障转移
我计划使用具有一台主服务器和多台从服务器的 MySQL 设置 服务器。我会在其中一台从属设备上定期执行数据 EBS 的一致性备份 服务器(我总是会先停止数据库并在完成后重新启动它)。
从站故障转移
如果其中一个从站发生故障,我将启动新实例并基于最新的从站快照挂载EBS作为新的数据盘。在这种情况下,master 随时可用。所以这就是我认为我应该做的:
0)确保服务器使用唯一的 server_id 1)从站停止;
2)重置从机;
3)启动从机;
4)重启mysql?
够了吗?
主故障转移 出于简单性和一致性的原因,我不想将其中一个奴隶提升为主人。我更喜欢从头开始创建新的主人。问题是快照来自从机,我想将其用作主机。这是我认为在基于从快照的磁盘创建新实例后应该做的事情:
1) STOP SLAVE;
2)重置主控;
3)重启mysql
4)将弹性IP关联到新的主数据库(故障主数据库使用相同的IP),因此从数据库将能够再次连接。
这个程序正确吗? 现在我该怎么处理奴隶呢?从站可以领先于主站,因为主站是从几个小时前的快照中恢复的。这是问题吗?还可以从用于恢复主服务器的同一快照重新创建所有从服务器。那么他们就和主人处于同样的地位了。但这可能很复杂,并且在不停机的情况下不可能继续进行。有什么更好的方法可以做到吗?
预先非常感谢您!
注意:我不介意自最新快照以来丢失的交易。我使用的是Mysql 5.1.41。
I plan to use MySQL setup with one master server and several slave
servers. I would perform regular consistent backup of the data EBS on one of the slave
servers (I will always stop database before and restart it when it is finished).
Slaves failover
I one of the slave fails, I will start new instance and moun EBS based on the latest slave snapshot as the new data disk. In this situation master is available all the time. So this is what I think I should do:
0) make sure server uses unique server_id
1) SLAVE STOP;
2) RESET SLAVE;
3) START SLAVE;
4) restart mysql?
Is that enough?
Master failover
For simplicity and consistency reasons I don't want to promote one of the slaves to master. I prefer to create new master from scratch. The problem is that the snapshot is from the slave and I want to use it as a master. This is what I think I should do after creating new instance with the disk based on the slave snapshot:
1) STOP SLAVE;
2) RESET MASTER;
3) restart mysql
4) associate elastic IP to the new master db (same IP was used by failed master), so the slaves will be able to connect again.
Is this procedure correct?
What should I do with the slaves now? Slaves can be ahead of the master, because master was restored from snapshot that can be several hours old. Is this problem? There is also possibility to recreate all the slaves from the same snapshot which was used to recover master. Then they would be on the same position as the master. But this could be complicated and impossible to proceed without downtime. Is there any better way how to do it?
Thank you very much in advance!
Notes: I don't mind lost transactions since the latest snapshot. I am using Mysql 5.1.41.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我用来恢复不同步服务器的两种方法是:
在这两种方法中,您都需要停止主机并重置主机。重置奴隶也会有帮助。
Two method that I use to restore out-of-sync servers is:
In both methods you will need to stop the master and reset the master. Reseting the slaves will also help.