一、环境
MGR 8.0.17 三节点,roidb1、roidb2、roidb3
二、测试
1、默认group_replication_member_weight=50
2、设置roidb2的权重为100
set global group_replication_member_weight=100;
3、关闭主库,shutdown;
4、查看主库,roidb2自动failover为主
mysql> select member_host,member_role from replication_group_members;
+-------------+-------------+
| member_host | member_role |
+-------------+-------------+
| roidb2 | PRIMARY |
| roidb1 | SECONDARY |
+-------------+-------------+
2 rows in set (0.00 sec)
三、知识点
通过设置此从参数来控制单主模式切换的顺序,前提MGR多节点的版本为统一版本。
group_replication_member_weight
Property Value
Command-Line Format --group-replication-member-weight=#
Introduced 8.0.2
System Variable group_replication_member_weight
Scope Global
Dynamic Yes
SET_VAR Hint Applies No
Type Integer
Default Value 50
Minimum Value 0
Maximum Value 100