There are two things you can do. The first would be to change the initial value of the live server to a very large number (above the expected number of rows)
EG:
ALTER TABLE tbl AUTO_INCREMENT = 10000;
Now the numbers will not overlap. If this is not an option, you can change the interval using
SET @@auto_increment_increment=10;
But it also means that there is overlap at one point. because the server in increments of 1 will catch up with increments of 10 after .. you guessed it .. 10 lines! But you can get around this by setting up one server to start the increment from 1 and the other to 2, and then do both steps in step 2.
Something like
intranet 1, 3, 5, 7, 9 live 2, 4, 6, 8, 10
You can also use a two-column primary key to prevent duplication. Now you have an auto-increment field combined with a varchar field (live and intr), and this is your unique key.
CREATE TABLE `casetest`.`manualid` ( `id` INT( 10 ) NOT NULL AUTO_INCREMENT , `server` VARCHAR( 4 ) NOT NULL DEFAULT 'live', `name` INT NOT NULL , PRIMARY KEY ( `id` , `server` ) ) ENGINE = MYISAM ;
Hugo delsing
source share