在主 - 主设置中,我可以编辑什么命令或文件,以便它可以自动增加2? [英] In a master-master setup, what command or files do I edit so that it can auto-increment by 2?
本文介绍了在主 - 主设置中,我可以编辑什么命令或文件,以便它可以自动增加2?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
一个服务器增量1,3,5。
One server increment 1, 3, 5.
其他服务器增量2,4,6
The other server increment 2, 4, 6
推荐答案
根据这篇精彩的教程: http:// www .howtoforge.com / mysql_master_master_replication#comment-12927
Based on this insightful tutorial: http://www.howtoforge.com/mysql_master_master_replication#comment-12927
通过将此添加到my.cnf在[mysqld]下使主数据1自动增加奇数:
Make Master 1 only auto-increment odd numbers by adding this to my.cnf under [mysqld]:
auto_increment_increment= 2
auto_increment_offset = 1
通过将此添加到my.cnf下的[mysqld]中,使Master 2只能自动增加偶数:
Make Master 2 only auto-increment even numbers by adding this to my.cnf under [mysqld]:
auto_increment_increment= 2
auto_increment_offset = 2
这篇关于在主 - 主设置中,我可以编辑什么命令或文件,以便它可以自动增加2?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文