1
votes

I'm studing a solution to do Mysql replication master-master within servers in different location, for redundancy, load balancing and fault tolerance. What I figured out so far is that is master-master replication inserts can be done in any of the servers and it will be replicated to the 2nd, 3rd... masters. I've checked all the tuturials about replications and ready ti implement and test. But there is a problem that i havent found a solution. Imagine a cenario on a database that all primary keys are INT and auto increment. What happens if two inserts are made on the same time on diferent master-master Mysql replicated servers, can I have the chance of loosinf integrety? Should the db struture have another colum identifying the id of the replication server? What concerns should I have about database struture on a master-master replication? Thanks

2

2 Answers

0
votes

Using a combination of auto_increment_increment and auto_increment_offset you can control which keys are created on which master and there should be no overlap.

0
votes

How about using something else than ints? There's also the possibility of using UUIDs/GUIDs. That way, you won't run into primary key conflicts.