lundi 1 décembre 2014

Mysql Multi master replication - auto_increment for tables with natural primary key?


I am thinking about using Master-Master replication using Mysql 5.6.19 with InnoDB as the engine.


From what I have been reading, looks like I should be using auto_increment_offset and auto_increment_increment as the primary keys for my table to avoid collisions in case of network failure between the masters.


My problem: Most of my tables already have a natural primary key. Using auto_increment as the primary key might avoid collisions but completely mess up my app as an account number might get inserted twice and there would be no way to stop it in the db layer.


My question: Do I really need to use auto_increment to avoid collisions? Is that the only way? Is there any other better solution out there?


Many thanks for your help.


--sa





Aucun commentaire:

Enregistrer un commentaire