如果master离线,如何将MySQL MySQL主数据库与Slave DB更改重新同步? [英] How to re-sync the master MySQL DB with Slave DB changes if master goes offline?
问题描述
Mysql Server 1作为主服务器运行. Mysql Server 2作为从属服务器运行.
因此,两个DB都在线时,它们处于完美同步"状态.如果从属服务器脱机,则即使主服务器仍处于在线状态也没问题-一旦从属服务器变为联机,它们便会同步.
除了服务器配置之外,如果主服务器脱机,我将重定向从服务器DB的连接(使用JSP代码)(我当然使用/etc/init.d/mysqld stop进行了测试).
当主服务器重新联机时,是否有任何自动方法将主服务器与从服务器更新同步?
Mysql Server 1 is running as master. Mysql Server 2 is running as slave.
So with both DBs online, they are in "perfect sync". If slave goes offline there''s no problem if master still online - they sync once slave becomes online.
Beside the server configuration, I redirected the connection (with JSP code) for the slave DB if the master goes offline (I tested of course with /etc/init.d/mysqld stop).
When the master goes back online, there''s any automatic method to sync the master with slave updates?
推荐答案
您是做什么的,而不是主从服务器的工作方式.主站只能复制到任意数量的从站.但是药膏不能更新主人.这就是主从"中的想法.
您要问的是MySQL Cluster,它是一个同步解决方案,使多个MySQL实例可以共享数据库信息.与复制(主从)不同,可以从群集中的任何节点读取或写入群集中的数据,并将信息分发到其他节点.
尝试从MySql中阅读此链接-高可用性和可伸缩性 [ ^ ]
---------------
有一个名为 MySql代理 [
What you what, is not how master-slave works. Master can only replicate to any number of slaves. But salves cannot update master. That is the idea in "master-slave".
What you are asking is called MySQL Cluster, it is a synchronous solution that enables multiple MySQL instances to share database information. Unlike replication (master-slave), data in a cluster can be read from or written to any node within the cluster, and information is distributed to the other nodes.
Try read this good link from MySql - High Availability and Scalability[^]
---------------
There is a program called MySql Proxy[^], that act as man-in-the-middle. One endpoint and many MySql servers.
But the point in master-slave, I think, is that you do SELECT query''s on the slaves and updates/delete on the master. This way you off-load the master.
这篇关于如果master离线,如何将MySQL MySQL主数据库与Slave DB更改重新同步?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!