Take the 2-minute tour ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

I've set up master-master replication of 2 servers and in one of the tables I use REPLACE INTO to update the data in a table. Is it possible that a link between the 2 servers goes down, then server 1 updates a certain row, a few seconds later the server 2 updates the same row and when the two get connected back, the more up-to-data on server 2 is overwritten by the data from server 1?

share|improve this question

1 Answer 1

You've just discovered why master-master "replication" setups with MySQL are not so much of a great idea. Worse yet, your changed data from server 2 is propagated to server 1 as well, so they will end up with different (swapped) data within the two replicas of your tables for good and never know about it. Except in the case where you are altering one of the columns you filter your query by, where replication will break (stop with an error) due to differencies in column count affected by the query (which is recorded and checked for by the MySQL replicator implementation).

You should use MySQL cluster if you want to pursue this kind of setup with MySQL - it has means to resolve this kind of conflicts coherently. In contrast to "free" MySQL setups, licensing is going to cost you $$$.

share|improve this answer
    
Thanks, I've actually tried that setup and can confirm that the changes got swapped in the end. –  Fluffy Apr 21 '12 at 8:17

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.