ITPub博客

首页 > 数据库 > MySQL > mgr参数-group_replication_auto_increment_increment

mgr参数-group_replication_auto_increment_increment

原创 MySQL 作者:贺子_DBA时代 时间:2024-01-01 22:59:36 0 删除 编辑
一、官方介绍
group_replication_auto_increment_increment参数表示:
当mgr开启多主模式的时候,控制自增的跨度,避免为组成员上的写入选择重复的自动增量值,这会导致事务回滚;
当在服务器实例上启动组复制时,服务器系统变量auto_increment_increment的值将更改为该值,而服务器系统变量auto_increment_offset的值将改为server id
当group_replication_single_pripary_mode为ON时,设置group_replification_auto_increment_increment无效
0
This system variable should have the same value on all group members. You cannot change the value of this system variable while Group Replication is running. You must stop Group Replication, change the value of the system variable, then restart Group Replication, on each of the group members. During this process, the value of the system variable is permitted to differ between group members, but some transactions on group members might be rolled back.
该系统变量在所有组成员上都应具有相同的值。当组复制正在运行时,您不能更改此系统变量的值。您必须停止组复制,更改系统变量的值,然后在每个组成员上重新启动组复制。在此过程中,允许组成员之间的系统变量值不同,但组成员上的某些事务可能会回滚。
group_replication_auto_increment_increment determines the interval between successive values for auto-incremented columns for transactions that execute on this server instance. Adding an interval avoids the selection of duplicate auto-increment values for writes on group members, which causes rollback of transactions. The default value of 7 represents a balance between the number of usable values and the permitted maximum size of a replication group (9 members). If your group has more or fewer members, you can set this system variable to match the expected number of group members before Group Replication is started.
group_replication_auto_increment_increment确定在此服务器实例上执行的事务的自动递增列的连续值之间的间隔。添加间隔可以避免为组成员上的写入选择重复的自动增量值,这会导致事务回滚。默认值7表示复制组(9个成员)的可用值数量和允许的最大大小之间的平衡。如果您的组有更多或更少的成员,则可以在启动组复制之前将此系统变量设置为与预期的组成员数相匹配。
Important
Setting group_replication_auto_increment_increment has no effect when group_replication_single_primary_mode is ON.
When Group Replication is started on a server instance, the value of the server system variable auto_increment_increment is changed to this value, and the value of the server system variable auto_increment_offset is changed to the server ID. The changes are reverted when Group Replication is stopped. These changes are only made and reverted if auto_increment_increment and auto_increment_offset each have their default value of 1. If their values have already been modified from the default, Group Replication does not alter them. In MySQL 8.0, the system variables are also not modified when Group Replication is in single-primary mode, where only one server writes.                                 
重要的
当group_replication_single_pripary_mode为ON时,设置group_replification_auto_increment_increment无效。
当在服务器实例上启动组复制时,服务器系统变量auto_increment_increment的值将更改为该值,而服务器系统变量auto_increment_offset的值将改为server id。当组复制停止时,更改将恢复。只有当auto_increment_increment和auto_increment_offset各自的默认值为1时,才会进行并恢复这些更改。如果它们的值已经从默认值修改,则组复制不会更改它们。在MySQL 8.0中,当组复制处于单一主模式(其中只有一台服务器写入)时,系统变量也不会被修改。
auto_increment_offset和auto_increment_increment是系统参数,分别用来表示自增的初始值和步长,默认值是1
二、参数设置
建设设置集群成员节点的server_id为不同的值,并且保持单调递增,建议分别设置成servier_id= 1\2\3,这样可以保证没有给定起始值的自增表,会从1开始生成自增值;
默认值为7,如果你的组中有更多或更少的组成员,则可以在组复制启动之前调整好该系统变量的值,以对应你的组中的成员数量;


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

下一篇: Oracle慢sql监控
请登录后发表评论 登录
全部评论
10年数据库管理员从业经历,熟悉Oracle、mysql、tidb、oceanbase、redis、 mongodb 、python等技术栈,持有11g ocm 、mysql 5.7 ocp 、tidb 5.0 ptcp、tidb 6.0 ptca、oceanbase obcp等

注册时间:2014-05-12

  • 博文量
    327
  • 访问量
    2148997