MySQL dual master self-growth conflict processing There are some differences between multi-master and master-slave replication, because there can be write access to the server in the host, so design to self-growing duplication problem (multi-master self-Growth ID duplication) 1: First we pass a A, a, a, B, the test table, There is a self-growth ID) to perform the insert operation, return an insert ID of 1 3: Stop B, insert the data table test on a (there is a self-growth ID), and return the insertion ID of 1 4: Then we start a A, a, and then a duplicate resolution of the primary key ID appears: We just need to ensure that the two servers inserted on the self-growth data is different, such as: a Chachi number id,b interpolation even ID, of course, if the server is more, you can define the algorithm, as long as the difference can be in here we add parameters on a, b to achieve the odd and even insert a:my.cnf parameters added Auto_ Increment_offset = 1 Auto_increment_increment = 2 The value produced by the Auto_increment field of a is: 1, 3, 5, 7, ... Equal odd ID is added on b:my.cnf parameter Auto_increment_offset = 2 Auto_increment_increment = 2 So the value of the Auto_increment field of B is: 2, 4, 6, 8, ... As you can see with even IDs, your auto_increment fields will never be duplicated between different servers, so there's no problem with the master-master structure. Of course, you can also use 3, 4, or n servers, just ensure that auto_increment_increment = N and then set the Auto_increment_offset as the appropriate initial value, then, Our MySQL can have dozens of master servers at the same time without the duplication of self-growth IDs. Http://www.2cto.com/database/201307/231397.html
MySQL dual master self-growth conflict handling