In a master-master setup, what command or files do I edit so that it can auto-increment by 2?

て烟熏妆下的殇ゞ 提交于 2019-12-12 04:21:22

问题


One server increment 1, 3, 5.

The other server increment 2, 4, 6


回答1:


Based on this insightful tutorial: http://www.howtoforge.com/mysql_master_master_replication#comment-12927

Make Master 1 only auto-increment odd numbers by adding this to my.cnf under [mysqld]:

auto_increment_increment= 2
auto_increment_offset   = 1

Make Master 2 only auto-increment even numbers by adding this to my.cnf under [mysqld]:

auto_increment_increment= 2
auto_increment_offset   = 2


来源:https://stackoverflow.com/questions/2105719/in-a-master-master-setup-what-command-or-files-do-i-edit-so-that-it-can-auto-in

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!