ITPub博客

首页 > 数据库 > MySQL > mysql的auto_increment_offset和auto_increment_increment配置

mysql的auto_increment_offset和auto_increment_increment配置

原创 MySQL 作者:zhangsharp20 时间:2017-11-27 14:28:17 0 删除 编辑

mysql中有自增长字段,在做数据库的主主同步时需要设置自增长的两个相关配置:auto_increment_offset和auto_increment_increment。

  • auto_increment_offset表示自增长字段从那个数开始,他的取值范围是1 .. 65535
  • auto_increment_increment表示自增长字段每次递增的量,其默认值是1,取值范围是1 .. 65535

在主主同步配置时,需要将两台服务器的auto_increment_increment增长量都配置为2,而要把auto_increment_offset分别配置为1和2.

这样才可以避免两台服务器同时做更新时自增长字段的值之间发生冲突。



官方文档: http://dev.mysql.com/doc/refman/5.0/en/replication-options-master.html


转载地址:http://outofmemory.cn/code-snippet/2447/mysql-auto-increment-offset-auto-increment-increment-configuration

来自 “ ITPUB博客 ” ,链接:https://blog.itpub.net/29802484/viewspace-2147803/ ,如需转载,请注明出处,否则将追究法律责任。

请登录后发表评论 登录
全部评论

注册时间:2014-08-12

  • 博文量
    382
  • 访问量
    801407