I tried implementing MySQL replication with 3 systems.
In my setup I have pairs as follows
(Master ,Slave )
(System_1,System_2)
(System_1,System_3)
(System_2,System_1)
(System_2,System_3)
(System_3,System_1)
(System_3,System_2)
So, every system is master and slave of every other system in this setup.
Every system is having local db as well.
Now in simple case everything is working fine. But in testing i faces an issue which is...
Say at some moment System_3 goes out of connectivity not at this moment all 3 system having some entries till id=3 (primary key and unique).
System_1
id | Value |
---|---|
1 | abc |
2 | xyz |
3 | pqr |
System_2
id | Value |
---|---|
1 | abc |
2 | xyz |
3 | pqr |
System_3
id | Value |
---|---|
1 | abc |
2 | xyz |
3 | pqr |
Now say when System_3 is offline it made some entry that will be going with id 4 in it table locally, in the mean time other two systems namely System_1, System_2 which are online, made some entry that will also go with id 4 in their respective table with replication.
Now say System_3 came online and it will read bin log file of other system and try to insert changes made at other system for replication at id 4. But boom System_3 already have value at id 4. Here replication got stop.
My question is how to solve this problem.