Click here to Skip to main content
15,888,320 members
Please Sign up or sign in to vote.
4.00/5 (1 vote)
See more:
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?
Posted
Updated 15-May-11 6:17am
v4

1 solution

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.
 
Share this answer
 
v2
Comments
Maxdd 7 15-May-11 11:21am    
I'm not sure you understood my question. The situation is: in case of master fails, even if I redirect to slave DB, when master is available how to sinc those DBs ?
Maxdd 7 15-May-11 11:23am    
I don't want to use mysql replication for optimization, my point is to use it to fault tolerance.
Maxdd 7 15-May-11 12:16pm    
I'm going to update the question.
Kim Togo 15-May-11 14:02pm    
Thanks, I have updated my answer.
Maxdd 7 15-May-11 14:15pm    
Okay, so that makes sense, thanks :)

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900