时间:2021-07-01 10:21:17 帮助过:4人阅读
mysql> show plugins;
master操作:
mysql> set SQL_LOG_BIN=0; #停掉日志记录
mysql> grant replication slave on *.* to repl@‘192.168.91.%‘ identified by ‘kavl7kAkkle!‘;
mysql> flush privileges;
mysql> set SQL_LOG_BIN=1; #开启日志记录
mysql> change master to master_user=‘repl‘,master_password=‘kavl7kAkkle!‘ for channel ‘group_replication_recovery‘; #构建group replication集群
mysql> SET GLOBAL group_replication_bootstrap_group=ON;
mysql> START GROUP_REPLICATION;
mysql> SET GLOBAL group_replication_bootstrap_group=OFF;
mysql> SET GLOBAL group_replication_bootstrap_group=OFF;
mysql> SELECT * FROM performance_schema.replication_group_members;
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 | e784156a-daa5-11e9-9184-000c29094ab4 | master | 3306 | ONLINE | PRIMARY | 8.0.17 |
+------------------------
node1和node2上操作:
mysql> set SQL_LOG_BIN=0; #停掉日志记录
mysql> grant replication slave on *.* to repl@‘192.168.91.%‘ identified by ‘kavl7kAkkle!‘;
mysql> flush privileges;
mysql> set SQL_LOG_BIN=1; #开启日志记录
mysql> change master to master_user=‘repl‘,master_password=‘kavl7kAkkle!‘ for channel ‘group_replication_recovery‘; #构建group replication集群
mysql> set global group_replication_allow_local_disjoint_gtids_join=ON; Query OK, 0 rows affected (0.01 sec)
mysql> reset master;
mysql> START GROUP_REPLICATION; Query OK, 0 rows affected (4.02 sec)
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 | e784156a-daa5-11e9-9184-000c29094ab4 | master | 3306 | ONLINE | PRIMARY | 8.0.17 |
| group_replication_applier | ed5719f8-daa5-11e9-b9f5-000c29824893 | node2 | 3306 | ONLINE | SECONDARY | 8.0.17 |
| group_replication_applier | f8cad554-dae8-11e9-84d3-000c29641ef8 | node1 | 3306 | ONLINE | SECONDARY | 8.0.17 |
+---------------------------+--------------------------------------+-------------+-------------+--------------+-------------+----------------+
3 rows in set (0.00 sec)
至此组搭建完成,组中有三个成员。
集群部署:
MySQL inodb cluster部署
标签:date -- line 接受 reset mysql 查看 ext recover