6.13. Auto-Increment in Multiple-Master Replication

MySQL 5.0

6.13. Auto-Increment in Multiple-Master Replication

When multiple servers are configured as replication masters, special steps must be taken to prevent key collisions when using columns, otherwise multiple masters may attempt to use the same value when inserting rows.

The and system variables help to accommodate multiple-master replication with columns. Each of these variables has a default and minimum value of 1, and a maximum value of 65,535. They were introduced in MySQL 5.0.2.

These two variables effect column behavior as follows:

  • controls the increment between successive values.

  • determines the starting point for column values.

By choosing non-conflicting values for these variables on different masters, servers in a multiple-master configuration will not use conflicting values when inserting new rows into the same table. To set up master servers, set the variables like this:

  • Set to on each master.

  • Set each of the masters to have a different , using the values 1, 2, …, .

For additional information about and , see Section 5.2.2, “Server System Variables”.