在主 - 主设置中,我编辑哪些命令或文件,以便它可以自动递增2?

时间:2010-01-20 23:04:01

标签: mysql database replication auto-increment

一个服务器增量1,3,5。

另一台服务器增加2,4,6

1 个答案:

答案 0 :(得分:1)

基于这个富有洞察力的教程:http://www.howtoforge.com/mysql_master_master_replication#comment-12927

让Master 1只通过在[mysqld]下添加到my.cnf来自动增加奇数:

auto_increment_increment= 2
auto_increment_offset   = 1

让Master 2只在[mysqld]下添加到my.cnf,自动增加偶数:

auto_increment_increment= 2
auto_increment_offset   = 2
相关问题