MySQL 组复制以 super_read_only

问题描述

我正在尝试设置 MysqL 组复制。唯一的问题是,当我尝试启动复制组时,它以 super_read_only 开头。

这里是 my.cnf 文件中的配置

[MysqLd]

max_binlog_size = 4096
default_authentication_plugin     = MysqL_native_password

log_bin                           = MysqL-bin-1.log
enforce_gtid_consistency          = ON
gtid_mode                         = ON
log_slave_updates                 = ON
binlog_checksum                   = NONE

plugin-load-add                   = group_replication.so
plugin-load-add                   = MysqL_clone.so
relay_log_recovery                = ON
transaction_write_set_extraction  = XXHASH64
loose_group_replication_start_on_boot                    = OFF
loose_group_replication_group_name                       = 74fe8890-679f-4e93-9169-a7edfbc1d427
loose_group_replication_group_seeds                      = MysqL_cluster_MysqL0_1:3306,MysqL_cluster_MysqL1_1:3306,MysqL_cluster_MysqL2_1:3306
loose_group_replication_single_primary_mode              = ON
loose_group_replication_enforce_update_everywhere_checks = OFF
bind-address = 0.0.0.0

实例在 docker 中运行,这就是组种子地址具有这些主机名的原因。

还有运行主实例的过程。

DELIMITER $$

USE `db`$$

DROP PROCEDURE IF EXISTS `set_as_master`$$

CREATE DEFINER=`root`@`%` PROCEDURE `set_as_master`()
BEGIN
  SET @@GLOBAL.group_replication_bootstrap_group=1;
  CREATE USER IF NOT EXISTS 'repl'@'%';
  GRANT REPLICATION SLAVE ON *.* TO repl@'%';
  FLUSH PRIVILEGES;
  CHANGE MASTER TO MASTER_USER='root' FOR CHANNEL 'group_replication_recovery';
  START GROUP_REPLICATION;
  -- SELECT * FROM performance_schema.replication_group_members;
END$$

DELIMITER;

sqlyog 中运行 CALL start_as_master; 后,进程卡在下面几行。

'CHANGE MASTER TO FOR CHANNEL 'group_replication_recovery' executed'. PrevIoUs state master_host='',master_port= 3306,master_log_file='',master_log_pos= 4,master_bind=''. New state master_host='',master_bind=''.

2021-03-03T21:47:55.934818Z 8 [System] [MY-013587] [Repl] Plugin group_replication reported: 'Plugin 'group_replication' is starting.'

2021-03-03T21:47:55.935929Z 9 [System] [MY-011565] [Repl] Plugin group_replication reported: 'Setting super_read_only=ON.'

为什么它以 super_read_only=ON 运行? 在配置或运行脚本的过程中我有什么遗漏吗?

MysqL 版本为 8.0.23。

解决方法

尝试运行这个然后重新启动复制

设置全局 super_read_only=0;

让我知道它是否有效