# 设置由该MySQL Server来引导组mysql> SET GLOBAL group_replication_bootstrap_group=ON;# 启动组复制mysql> START GROUP_REPLICATION;# 在该MySQL Server中,组复制启动完成之后,引导组的工作也一起完成了,为避免后续一系列意外原因可能发生脑裂,需要将引导组的开关参数及时关闭mysql> SET GLOBAL group_replication_bootstrap_group=OFF;
一旦START 语句执行完成,代表着组就已经启动完成了 。可以通过.mbers表中记录的组成员信息来查看组成员的状态:
# 从下面的内容中,我们可以看到,当前只有1个成员s1(每个成员有一行单独的记录),处于ONLINE状态,成员唯一标识符为ce9be252-2b71-11e6-b8f4-00212844f856(成员的server_uuid系统变量中获取的值),正在端口3306上监听客户端连接(注意这里是SQL访问端口,不是组成员之间的通讯端口)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 | 395409e1-6dfa-11e6-970b-00212844f856 | s1| 3306 | ONLINE | PRIMARY | 8.0.17 |+---------------------------+--------------------------------------+-------------+-------------+--------------+-------------+----------------+1 row in set (0.01 sec)
为了演示MySQL 确实处在一个组中,并且能够处理负载(指业务访问流量),下面制造一些测试数据,语句如下:
# 登录数据库中,执行建库,建表,并插入测试数据mysql> CREATE DATABASE test;mysql> USE test;mysql> CREATE TABLE t1 (c1 INT PRIMARY KEY, c2 TEXT NOT NULL);mysql> INSERT INTO t1 VALUES (1, 'Luis');# 检查表t1中的数据mysql> SELECT * FROM t1;+----+------+| c1 | c2 |+----+------+| 1 | Luis |+----+------+# 检查二进制日志的内容(注:使用SHOW BINLOG EVENTS语句只能看到statement格式的语句文本和event结构信息,无法看到row格式的BINLOG编码文本)mysql> SHOW BINLOG EVENTS;+---------------+-----+----------------+-----------+-------------+--------------------------------------------------------------------+| Log_name | Pos | Event_type | Server_id | End_log_pos | Info |+---------------+-----+----------------+-----------+-------------+--------------------------------------------------------------------+| binlog.000001 | 4 | Format_desc | 1 | 123 | Server ver: 8.0.19-log, Binlog ver: 4 || binlog.000001 | 123 | Previous_gtids | 1 | 150 | || binlog.000001 | 150 | Gtid | 1 | 211 | SET @@SESSION.GTID_NEXT= 'aaaaaaaa-aaaa-aaaa-aaaa-aaaaaaaaaaaa:1' || binlog.000001 | 211 | Query | 1 | 270 | BEGIN || binlog.000001 | 270 | View_change | 1 | 369 | view_id=14724817264259180:1 || binlog.000001 | 369 | Query | 1 | 434 | COMMIT || binlog.000001 | 434 | Gtid | 1 | 495 | SET @@SESSION.GTID_NEXT= 'aaaaaaaa-aaaa-aaaa-aaaa-aaaaaaaaaaaa:2' || binlog.000001 | 495 | Query | 1 | 585 | CREATE DATABASE test || binlog.000001 | 585 | Gtid | 1 | 646 | SET @@SESSION.GTID_NEXT= 'aaaaaaaa-aaaa-aaaa-aaaa-aaaaaaaaaaaa:3' || binlog.000001 | 646 | Query | 1 | 770 | use `test`; CREATE TABLE t1 (c1 INT PRIMARY KEY, c2 TEXT NOT NULL) || binlog.000001 | 770 | Gtid | 1 | 831 | SET @@SESSION.GTID_NEXT= 'aaaaaaaa-aaaa-aaaa-aaaa-aaaaaaaaaaaa:4' || binlog.000001 | 831 | Query | 1 | 899 | BEGIN || binlog.000001 | 899 | Table_map | 1 | 942 | table_id: 108 (test.t1) || binlog.000001 | 942 | Write_rows | 1 | 984 | table_id: 108 flags: STMT_END_F || binlog.000001 | 984 | Xid | 1 | 1011 | COMMIT /* xid=38 */ |+---------------+-----+----------------+-----------+-------------+--------------------------------------------------------------------+
- 【Kerberos】开启了kerberos的ambari中组件shell访问
- Hadoop集群下安装并运行一个Hama实例
- conda无法更新或安装模块
- 电脑不能安装linux系统安装软件,没网情况用U盘安装Ubuntu20
- centos7 物理机安装后没有网卡解决办法
- 安装OpenWrt到电脑,安装包选哪个?
- Java swing中树状组件JTree的使用,左边点击不同菜单
- 电源全模组和直出线哪个好
- Ubuntu 20.04 安装一直卡在 “更新和其他软件“ 界面
- U盘安装Linux时非常卡