MySQL5.7 Group Replication (MGR) 集群搭建(3)

3.1.4 启动服务器apollo.mgr.com上mysql的group replication -- 设置group_replication_bootstrap_group为ON是为了标示以后加入集群的服务器以这台服务器为基准,以后加入的就不需要设置。 mysql> set global group_replication_bootstrap_group=ON; -- 作为首个节点启动mgr集群 mysql> start group_replication; mysql> set global group_replication_bootstrap_group=OFF;

3.1.5 查看mgr的状态 -- 查询表performance_schema.replication_group_members mysql> select * from performance_schema.replication_group_members; +---------------------------+--------------------------------------+----------------+-------------+--------------+ | CHANNEL_NAME | MEMBER_ID | MEMBER_HOST | MEMBER_PORT | MEMBER_STATE | +---------------------------+--------------------------------------+----------------+-------------+--------------+ | group_replication_applier | ecf48652-1c72-11e7-a7c1-08002785d027 | apollo.mgr.com | 3306 | ONLINE | +---------------------------+--------------------------------------+----------------+-------------+--------------+

3.1.6 测试服务器apollo.mgr.com上的mysql mysql> create database test; Query OK, 1 row affected (0.01 sec) mysql> use test; Database changed mysql> create table t1(c1 int primary key, c2 text not null); Query OK, 0 rows affected (0.01 sec) mysql> insert into t1 values (1, 'Luis'); Query OK, 1 row affected (0.01 sec) mysql> select * from t1; +----+------+ | c1 | c2 | +----+------+ | 1 | Luis | +----+------+ 1 row in set (0.00 sec) mysql> show binlog events; +---------------+-----+----------------+-----------+-------------+-------------------------------------------------------------------+ | Log_name | Pos | Event_type | Server_id | End_log_pos | Info | +---------------+-----+----------------+-----------+-------------+-------------------------------------------------------------------+ | binlog.000001 | 4 | Format_desc | 181 | 123 | Server ver: 5.7.17-log, Binlog ver: 4 | | binlog.000001 | 123 | Previous_gtids | 181 | 150 | | | binlog.000001 | 150 | Gtid | 181 | 211 | SET @@SESSION.GTID_NEXT= 'ce9be252-2b71-11e6-b8f4-00212844f856:1' | | binlog.000001 | 211 | Query | 181 | 270 | BEGIN | | binlog.000001 | 270 | View_change | 181 | 369 | view_id=14916679781649312:1 | | binlog.000001 | 369 | Query | 181 | 434 | COMMIT | | binlog.000001 | 434 | Gtid | 181 | 495 | SET @@SESSION.GTID_NEXT= 'ce9be252-2b71-11e6-b8f4-00212844f856:2' | | binlog.000001 | 495 | Query | 181 | 585 | create database test | | binlog.000001 | 585 | Gtid | 181 | 646 | SET @@SESSION.GTID_NEXT= 'ce9be252-2b71-11e6-b8f4-00212844f856:3' | | binlog.000001 | 646 | Query | 181 | 769 | use `test`; create table t1(c1 int primary key, c2 text not null) | | binlog.000001 | 769 | Gtid | 181 | 830 | SET @@SESSION.GTID_NEXT= 'ce9be252-2b71-11e6-b8f4-00212844f856:4' | | binlog.000001 | 830 | Query | 181 | 898 | BEGIN | | binlog.000001 | 898 | Table_map | 181 | 941 | table_id: 219 (test.t1) | | binlog.000001 | 941 | Write_rows | 181 | 983 | table_id: 219 flags: STMT_END_F | | binlog.000001 | 983 | Xid | 181 | 1010 | COMMIT /* xid=40 */ | +---------------+-----+----------------+-----------+-------------+-------------------------------------------------------------------+ 15 rows in set (0.00 sec)

内容版权声明:除非注明,否则皆为本站原创文章。

转载注明出处:https://www.heiqu.com/60c44045b44f7ddebe96b40d47f6081b.html