MySQL主主手复制

发布于 2025-02-08 15:22:40 字数 261 浏览 1 评论 0原文

我有两个服务器具有相同版本的“ mysql ver 15.1 distrib 10.6.8-mariadb”,在CentOS 7上,

我已经实现了MySQL Master-Master复制,Master1在Server-1上,Master2在Server-2上是在Server-2上 当一台服务器下降或主降低时,会发生什么,

我假设如果一台服务器下降,它将切换为写入同一主机,当服务器返回时,它将开始复制缺失的数据到Master2。 我不确定。

任何信息都会有所帮助

I have two servers with same version "mysql Ver 15.1 Distrib 10.6.8-MariaDB," on centos 7

I have implemented Mysql Master-Master Replication, master1 is on server-1 and master2 is on server-2
what happens when the either one of the servers goes down or the master goes Down

I am assuming if the one server goes down, it will switch to writes to the same master and when the server comes back up, it will start replicating the missing data to master2.
I am not sure about it.

any information would be helpful

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

海之角 2025-02-15 15:22:40

由于复制已经是异步的,如果服务器下降,另一个服务器将累积其更改的二进制日志。当服务器恢复后,它通常会恢复复制并逐渐赶上。取决于它的停机时间以及在服务器上仍在运行的二进制日志中积累的变化的速度,服务器可能需要一些时间才能赶上。

通常,二进制日志被配置为使用expire_logs_days选项自动过期。如果服务器的停机时间太长,以至于在服务器可以获取并赶上服务器之前,某些二进制日志已过期,则服务器基本上是垃圾,必须从另一个备份的新备份中重新启动。没有完整的二进制日志,就无法可靠地赶上。

我不知道Mariadb具有将流量切换到另一个实例的任何自动方法。这取决于客户知道要使用哪个写作。有几种不同的方法可以处理此操作,但是在100%的情况下,它们都不是完全自动的。

最好将其提供手册,但可以快速可靠地进行开关。这允许人类在执行开关时进行判断。但是,如果这些步骤符合良好的标题,一旦人类调用了步骤,则将正确地发生。最好使其成为一个单个命令,以便即使您要半睡一半,也可以做到。服务器有一个习惯,当您不醒来时就会下降! :-(

Since replication is asynchronous already, if a server goes down, the other server will just accumulate its binary log of changes. When the server comes back up, it typically resumes replication and gradually catches up. Depending on how long it was down and how rapidly the changes accumulated in the binary logs on the server that remained running, it could take some time for the server to catch up.

Often binary logs are configured to expire automatically with the expire_logs_days option. If a server is down so long that some binary logs are expired before the server can get them and catch up, then the server is basically trash, and has to be reinitialized from a fresh backup of the other one. There's no way to reliably catch up without a complete sequence of binary logs.

I'm not aware that MariaDB has any automatic way of switching traffic to the other instance. This is up to the client to know which one to use for writes. There are several different ways to handle this, but none of them are perfectly automatic in 100% of cases.

It's better to leave it manual, but make the switch quick and reliable to make. That allows a human to make a judgment call when to perform the switch. But if the steps are well-scripted, once the human invokes it, it will happen correctly. It's best to make it a single command so you can do it even if you're half-asleep. Servers have a habit of going down when you're not awake! :-(

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文