谁能看到我哪里出错了,因为这正在驱使我转弯。
我已经在我的 Windows 10 笔记本电脑上安装了全新的 MySQL 8.0.17。我已经完成了整个initialize
过程,登录并设置了root
用户并将其设置为服务。
my.ini 文件包含(其中包括):
port = 3306
server-id = 8306
binlog_format = row
relay-log-info-repository = TABLE
master-info-repository = TABLE
gtid_mode = ON
enforce_gtid_consistency = ON
binlog_checksum = NONE
到目前为止,一切都很好。我登录,一切正常。
接下来我关闭 MySQL,并将以下内容添加到 my.cnf 文件中。
#GROUP REPLICATION#
loose-transaction_write_set_extraction=XXHASH64
loose-group_replication_group_name="1587d451-feca-11e8-a7b3-c85b768dc0dd"
loose-group_replication_start_on_boot=off
loose-group_replication_local_address= "127.0.0.1:33061"
loose-group_replication_group_seeds= "127.0.0.1:33061"
loose-group_replication_bootstrap_group=off
loose-group_replication_member_weight=100
loose-group_replication_ip_whitelist="169.254.243.231"
添加最后一个条目是因为之前的尝试抱怨它不在白名单中。
我再次重新启动 MySQL。
现在我开始设置组复制。
SET SQL_LOG_BIN=0;
CREATE USER 'GReplication'@'%' IDENTIFIED WITH 'mysql_native_password' BY '@Replication123';
GRANT REPLICATION SLAVE ON *.* TO 'GReplication'@'%';
SET SQL_LOG_BIN=1;
CHANGE MASTER TO MASTER_USER='GReplication', MASTER_PASSWORD='@Replication123' FOR CHANNEL 'group_replication_recovery';
INSTALL PLUGIN group_replication SONAME 'group_replication.dll';
SHOW PLUGINS;
SET GLOBAL group_replication_bootstrap_group=ON;
START GROUP_REPLICATION;
SET GLOBAL group_replication_bootstrap_group=OFF;
SELECT * FROM performance_schema.replication_group_members;
这显示了一个活跃的成员。
MySQL localhost:3306 ssl SQL > SELECT * FROM performance_schema.replication_group_members;
+---------------------------+--------------------------------------+-------------+-------------+--------------+-------------+----------------+
| CHANNEL_NAME | MEMBER_ID | MEMBER_HOST | MEMBER_PORT | MEMBER_STATE | MEMBER_ROLE | MEMBER_VERSION |
+---------------------------+--------------------------------------+-------------+-------------+--------------+-------------+----------------+
| group_replication_applier | 454b0127-b204-11e9-a032-c85b768dc0db | pc12345 | 3306 | ONLINE | PRIMARY | 8.0.17 |
+---------------------------+--------------------------------------+-------------+-------------+--------------+-------------+----------------+
1 row in set (0.0005 sec)
我现在将 my.ini 文件中的以下行更改为“on”
loose-group_replication_start_on_boot=on
并重新启动 MySQL。
但是,当我检查时,我现在得到:
MySQL localhost:3306 ssl SQL > SELECT * FROM performance_schema.replication_group_members;
+---------------------------+--------------------------------------+-------------+-------------+--------------+-------------+----------------+
| CHANNEL_NAME | MEMBER_ID | MEMBER_HOST | MEMBER_PORT | MEMBER_STATE | MEMBER_ROLE | MEMBER_VERSION |
+---------------------------+--------------------------------------+-------------+-------------+--------------+-------------+----------------+
| group_replication_applier | 454b0127-b204-11e9-a032-c85b768dc0db | pc12345 | 3306 | OFFLINE | | |
+---------------------------+--------------------------------------+-------------+-------------+--------------+-------------+----------------+
1 row in set (0.0005 sec)
查看错误日志,一切似乎都运行良好,直到:
2019-07-29T15:26:17.651950Z 0 [ERROR] [MY-011735] [Repl] Plugin group_replication reported: '[GCS] Error connecting to all peers. Member join failed. Local port: 33061'
2019-07-29T15:26:17.791783Z 0 [ERROR] [MY-011735] [Repl] Plugin group_replication reported: '[GCS] The member was unable to join the group. Local port: 33061'
2019-07-29T15:27:17.469988Z 2 [ERROR] [MY-011640] [Repl] Plugin group_replication reported: 'Timeout on wait for view after joining group'
2019-07-29T15:27:17.473776Z 2 [Note] [MY-011649] [Repl] Plugin group_replication reported: 'Requesting to leave the group despite of not being a member'
2019-07-29T15:27:17.476534Z 2 [ERROR] [MY-011735] [Repl] Plugin group_replication reported: '[GCS] The member is leaving a group without being on one.'
2019-07-29T15:27:17.492689Z 12 [Note] [MY-010596] [Repl] Error reading relay log event for channel 'group_replication_applier': slave SQL thread was killed
2019-07-29T15:27:17.495987Z 12 [Note] [MY-010587] [Repl] Slave SQL thread for channel 'group_replication_applier' exiting, replication stopped in log 'FIRST' at position 0
2019-07-29T15:27:17.498976Z 9 [Note] [MY-011444] [Repl] Plugin group_replication reported: 'The group replication applier thread was killed.'
我假设我在某处遗漏了一步,但它是什么?我浏览了所有我能找到的文档,但看不出有什么不同?
我也尝试在 Linux 上设置它,结果大致相同。
是的,您正在重新启动服务器
但是你没有做的是告诉服务器引导组。由于您只有一个成员,因此您基本上是在尝试在开始时创建一个组
Group Replication 理想情况下与多个成员一起使用,在这样的设置中,该成员在重新启动时将在组中拥有其他成员,并且您的测试将成功。
或者,您可以设置
但请记住,当您添加更多成员时,应该更改此设置。