我已经将 MySQL 服务器(bitnami helmchart)部署到 openshift 集群(版本 8.0.25-debian-10-r16)并使用此处的文档创建了一个组复制集群:https ://dev.mysql.com/doc/refman/ 8.0/en/group-replication.html
Mysql 服务器引导组复制没有任何问题:
mysql> SELECT * FROM performance_schema.replication_group_members;
+---------------------------+--------------------------------------+---------------+-------------+--------------+-------------+----------------+
| CHANNEL_NAME | MEMBER_ID | MEMBER_HOST | MEMBER_PORT | MEMBER_STATE | MEMBER_ROLE | MEMBER_VERSION |
+---------------------------+--------------------------------------+---------------+-------------+--------------+-------------+----------------+
| group_replication_applier | be431342-8366-11ec-bea6-ea1fb6641f44 | mysql-0 | 3306 | ONLINE | PRIMARY | 8.0.25 |
+---------------------------+--------------------------------------+---------------+-------------+--------------+-------------+----------------+
1 row in set (0.02 sec)
现在我想在虚拟机上加入另一个 MySQL 实例,为此,首先我创建一个LoadBalancer
服务来访问 openshift 集群之外的 MySQL 端口。而且我可以远程登录,也可以3306
从33061
虚拟机登录。但是,当我在 VM 上的 Mysql 实例上创建复制用户并开始复制时,START GROUP_REPLICATION USER='rpl_user', PASSWORD='password';
我在 vm 的日志中收到以下错误:
[ERROR] [MY-011735] [Repl] Plugin group_replication reported: '[GCS] Timeout while waiting for the group communication engine to be ready!'
[ERROR] [MY-011735] [Repl] Plugin group_replication reported: '[GCS] The group communication engine is not ready for the member to join. Local port: 33061'
[ERROR] [MY-011735] [Repl] Plugin group_replication reported: '[GCS] The member was unable to join the group. Local port: 33061'
[ERROR] [MY-011640] [Repl] Plugin group_replication reported: 'Timeout on wait for view after joining group'
[ERROR] [MY-011735] [Repl] Plugin group_replication reported: '[GCS] The member is already leaving or joining a group.'
[ERROR] [MY-011735] [Repl] Plugin group_replication reported: '[GCS] Timeout while waiting for the group communication engine to be ready!'
[ERROR] [MY-011735] [Repl] Plugin group_replication reported: '[GCS] The group communication engine is not ready for the member to join. Local port: 33061'
[ERROR] [MY-011735] [Repl] Plugin group_replication reported: '[GCS] The member was unable to join the group. Local port: 33061'
VM 的 IP 地址在 openshift 上部署的 MySQL 的白名单中,我在 Mysql 的 pod 上没有看到任何错误
这是openshift上的Mysql配置:
[mysqld]
disabled_storage_engines="MyISAM,BLACKHOLE,FEDERATED,ARCHIVE,MEMORY"
server_id=1
gtid_mode=ON
enforce_gtid_consistency=ON
binlog_checksum=NONE
plugin_load_add='group_replication.so'
group_replication_group_name="aaaaaaaa-aaaa-aaaa-aaaa-aaaaaaaaaaaa"
group_replication_start_on_boot=off
group_replication_local_address= "mysql-0:33061"
group_replication_ip_allowlist= "172.16.0.0/12"
group_replication_group_seeds= "172.16.60.5:33061,172.20.1.223:33061"
group_replication_bootstrap_group=off
bind-address=0.0.0.0
default_authentication_plugin=mysql_native_password
skip-name-resolve
explicit_defaults_for_timestamp
basedir=/opt/bitnami/mysql
plugin_dir=/opt/bitnami/mysql/lib/plugin
port=3306
socket=/opt/bitnami/mysql/tmp/mysql.sock
datadir=/bitnami/mysql/data
tmpdir=/opt/bitnami/mysql/tmp
max_allowed_packet=16M
bind-address=0.0.0.0
pid-file=/opt/bitnami/mysql/tmp/mysqld.pid
log-error=/opt/bitnami/mysql/logs/mysqld.log
character-set-client-handshake = FALSE
character-set-server=utf8mb4
collation-server=utf8mb4_unicode_ci
[mysql]
default-character-set = utf8mb4
[client]
port=3306
socket=/opt/bitnami/mysql/tmp/mysql.sock
default-character-set=utf8mb4
plugin_dir=/opt/bitnami/mysql/lib/plugin
[manager]
port=3306
socket=/opt/bitnami/mysql/tmp/mysql.sock
pid-file=/opt/bitnami/mysql/tmp/mysqld.pid
虚拟机上的Mysql配置:
[mysqld]
#
# * Basic Settings
#
user = mysql
server_id=2
gtid_mode=ON
enforce_gtid_consistency=ON
binlog_checksum=NONE
plugin_load_add='group_replication.so'
group_replication_group_name="aaaaaaaa-aaaa-aaaa-aaaa-aaaaaaaaaaaa"
group_replication_start_on_boot=off
group_replication_local_address= "mysql-1:33061"
group_replication_ip_allowlist= "172.16.0.0/12"
group_replication_group_seeds= "172.16.60.5:33061,172.20.1.223:33061"
group_replication_bootstrap_group=off
default_authentication_plugin=mysql_native_password
skip-name-resolve
explicit_defaults_for_timestamp
port=3306
socket=/var/run/mysqld/mysqld.sock
datadir=/var/lib/mysql
tmpdir=/tmp
max_allowed_packet=16M
bind-address=0.0.0.0
pid-file=/var/run/mysqld/mysqld.pid
log_error = /var/log/mysql/error.log
character-set-server=UTF8
collation-server=utf8_general_ci
[client]
port=3306
socket=/var/run/mysqld/mysqld.sock
default-character-set=UTF8
[manager]
port=3306
socket=/var/run/mysqld/mysqld.sock
pid-file=/var/run/mysqld/mysqld.pid
这172.16.60.5
是 openshift 上 MySQL 的负载均衡器 IP 和172.20.1.223
VM 上 MySQL 的 IP,它们都可以在端口3306
和33061