MySQL中对于表上ID自增列可以在创建表的时候指定列上的auto_increment属性和auto_increment_offset属性。
auto_increment_increment控制列中的值的增量值,也就是步长。
auto_increment_offset确定AUTO_INCREMENT列值的起点,也就是初始值。

 

log-slave-updates = true     #将复制事件写入binlog,一台服务器既做主库又做从库此选项必须要开启

#masterA自增长ID
auto_increment_offset = 1
auto_increment_increment = 2       #奇数ID                                   

 
#masterB自增加ID
auto_increment_offset = 2
auto_increment_increment = 2        #偶数ID

 

参考
作者:XiaoMing丶
链接:https://www.jianshu.com/p/f63a4e7941e2
来源:简书
著作权归作者所有。商业转载请联系作者获得授权,非商业转载请注明出处。

 

MySQL双主(主主)架构方案 - ygqygq2 - 博客园

https://www.cnblogs.com/ygqygq2/p/6045279.html

相关文章:

  • 2022-01-01
  • 2022-12-23
  • 2021-06-19
  • 2021-07-23
  • 2022-12-23
  • 2021-11-11
  • 2018-09-26
猜你喜欢
  • 2021-10-09
  • 2021-09-19
  • 2022-12-23
  • 2021-05-26
  • 2022-01-23
  • 2018-06-14
  • 2021-05-31
相关资源
相似解决方案