MySql 5.7.26 MGR 安装以及配置

Server 1

[mysqld]

# server configuration
datadir=/data/s1
basedir=/mysql-5.7/

port=3306
socket=/s1.sock

server_id=1
gtid_mode=ON
enforce_gtid_consistency=ON
master_info_repository=TABLE
relay_log_info_repository=TABLE
binlog_checksum=NONE
log_slave_updates=ON
log_bin=binlog
binlog_format=ROW

transaction_write_set_extraction=XXHASH64
group_replication_group_name="aaaaaaaa-aaaa-aaaa-aaaa-aaaaaaaaaaaa"
group_replication_start_on_boot=off
group_replication_local_address= "10.27.139.189:33063"
group_replication_group_seeds= "10.27.139.187:33061,10.27.139.188:33062,10.27.139.189:33063"
group_replication_bootstrap_group=off

起库

/usr/local/mysql/bin/mysqld_safe --defaults-file=/home/mysql/etc/my.cnf &

复制用户

mysql> SET SQL_LOG_BIN=0;
mysql> CREATE USER rpl_user@'%' IDENTIFIED BY 'password';
mysql> GRANT REPLICATION SLAVE ON *.* TO rpl_user@'%';
mysql> FLUSH PRIVILEGES;
mysql> SET SQL_LOG_BIN=1;

起复制

mysql> CHANGE MASTER TO MASTER_USER='rpl_user', MASTER_PASSWORD='password' FOR CHANNEL 'group_replication_recovery';

INSTALL PLUGIN group_replication SONAME 'group_replication.so';
mysql> SHOW PLUGINS;
+----------------------------+----------+--------------------+----------------------+-------------+
| Name                       | Status   | Type               | Library              | License     |
+----------------------------+----------+--------------------+----------------------+-------------+
| binlog                     | ACTIVE   | STORAGE ENGINE     | NULL                 | PROPRIETARY |
| mysql_native_password      | ACTIVE   | AUTHENTICATION     | NULL                 | PROPRIETARY |
| sha256_password            | ACTIVE   | AUTHENTICATION     | NULL                 | PROPRIETARY |
| MRG_MYISAM                 | ACTIVE   | STORAGE ENGINE     | NULL                 | PROPRIETARY |
| MyISAM                     | ACTIVE   | STORAGE ENGINE     | NULL                 | PROPRIETARY |
| CSV                        | ACTIVE   | STORAGE ENGINE     | NULL                 | PROPRIETARY |
| MEMORY                     | ACTIVE   | STORAGE ENGINE     | NULL                 | PROPRIETARY |
| PERFORMANCE_SCHEMA         | ACTIVE   | STORAGE ENGINE     | NULL                 | PROPRIETARY |
| InnoDB                     | ACTIVE   | STORAGE ENGINE     | NULL                 | PROPRIETARY |
| INNODB_TRX                 | ACTIVE   | INFORMATION SCHEMA | NULL                 | PROPRIETARY |
| INNODB_LOCKS               | ACTIVE   | INFORMATION SCHEMA | NULL                 | PROPRIETARY |
| INNODB_LOCK_WAITS          | ACTIVE   | INFORMATION SCHEMA | NULL                 | PROPRIETARY |
| INNODB_CMP                 | ACTIVE   | INFORMATION SCHEMA | NULL                 | PROPRIETARY |
| INNODB_CMP_RESET           | ACTIVE   | INFORMATION SCHEMA | NULL                 | PROPRIETARY |
| INNODB_CMPMEM              | ACTIVE   | INFORMATION SCHEMA | NULL                 | PROPRIETARY |
| INNODB_CMPMEM_RESET        | ACTIVE   | INFORMATION SCHEMA | NULL                 | PROPRIETARY |
| INNODB_CMP_PER_INDEX       | ACTIVE   | INFORMATION SCHEMA | NULL                 | PROPRIETARY |
| INNODB_CMP_PER_INDEX_RESET | ACTIVE   | INFORMATION SCHEMA | NULL                 | PROPRIETARY |
| INNODB_BUFFER_PAGE         | ACTIVE   | INFORMATION SCHEMA | NULL                 | PROPRIETARY |
| INNODB_BUFFER_PAGE_LRU     | ACTIVE   | INFORMATION SCHEMA | NULL                 | PROPRIETARY |
| INNODB_BUFFER_POOL_STATS   | ACTIVE   | INFORMATION SCHEMA | NULL                 | PROPRIETARY |
| INNODB_TEMP_TABLE_INFO     | ACTIVE   | INFORMATION SCHEMA | NULL                 | PROPRIETARY |
| INNODB_METRICS             | ACTIVE   | INFORMATION SCHEMA | NULL                 | PROPRIETARY |
| INNODB_FT_DEFAULT_STOPWORD | ACTIVE   | INFORMATION SCHEMA | NULL                 | PROPRIETARY |
| INNODB_FT_DELETED          | ACTIVE   | INFORMATION SCHEMA | NULL                 | PROPRIETARY |
| INNODB_FT_BEING_DELETED    | ACTIVE   | INFORMATION SCHEMA | NULL                 | PROPRIETARY |
| INNODB_FT_CONFIG           | ACTIVE   | INFORMATION SCHEMA | NULL                 | PROPRIETARY |
| INNODB_FT_INDEX_CACHE      | ACTIVE   | INFORMATION SCHEMA | NULL                 | PROPRIETARY |
| INNODB_FT_INDEX_TABLE      | ACTIVE   | INFORMATION SCHEMA | NULL                 | PROPRIETARY |
| INNODB_SYS_TABLES          | ACTIVE   | INFORMATION SCHEMA | NULL                 | PROPRIETARY |
| INNODB_SYS_TABLESTATS      | ACTIVE   | INFORMATION SCHEMA | NULL                 | PROPRIETARY |
| INNODB_SYS_INDEXES         | ACTIVE   | INFORMATION SCHEMA | NULL                 | PROPRIETARY |
| INNODB_SYS_COLUMNS         | ACTIVE   | INFORMATION SCHEMA | NULL                 | PROPRIETARY |
| INNODB_SYS_FIELDS          | ACTIVE   | INFORMATION SCHEMA | NULL                 | PROPRIETARY |
| INNODB_SYS_FOREIGN         | ACTIVE   | INFORMATION SCHEMA | NULL                 | PROPRIETARY |
| INNODB_SYS_FOREIGN_COLS    | ACTIVE   | INFORMATION SCHEMA | NULL                 | PROPRIETARY |
| INNODB_SYS_TABLESPACES     | ACTIVE   | INFORMATION SCHEMA | NULL                 | PROPRIETARY |
| INNODB_SYS_DATAFILES       | ACTIVE   | INFORMATION SCHEMA | NULL                 | PROPRIETARY |
| INNODB_SYS_VIRTUAL         | ACTIVE   | INFORMATION SCHEMA | NULL                 | PROPRIETARY |
| BLACKHOLE                  | ACTIVE   | STORAGE ENGINE     | NULL                 | PROPRIETARY |
| partition                  | ACTIVE   | STORAGE ENGINE     | NULL                 | PROPRIETARY |
| ARCHIVE                    | ACTIVE   | STORAGE ENGINE     | NULL                 | PROPRIETARY |
| FEDERATED                  | DISABLED | STORAGE ENGINE     | NULL                 | PROPRIETARY |
| ngram                      | ACTIVE   | FTPARSER           | NULL                 | PROPRIETARY |
| group_replication          | ACTIVE   | GROUP REPLICATION  | group_replication.so | PROPRIETARY |
+----------------------------+----------+--------------------+----------------------+-------------+
45 rows in set (0.04 sec)

mysql> SET GLOBAL group_replication_bootstrap_group=ON;
Query OK, 0 rows affected (0.00 sec)

mysql> START GROUP_REPLICATION;
Query OK, 0 rows affected (2.05 sec)

mysql> SET GLOBAL group_replication_bootstrap_group=OFF;
Query OK, 0 rows affected (0.00 sec)

mysql> SELECT * FROM performance_schema.replication_group_members;
+---------------------------+--------------------------------------+--------------+-------------+--------------+
| CHANNEL_NAME              | MEMBER_ID                            | MEMBER_HOST  | MEMBER_PORT | MEMBER_STATE |
+---------------------------+--------------------------------------+--------------+-------------+--------------+
| group_replication_applier | 7795a070-7787-11e9-b0cb-fa163efd414a | archsitdb203 |        3306 | ONLINE       |
+---------------------------+--------------------------------------+--------------+-------------+--------------+
1 row in set (0.00 sec)

Server 2

[mysqld]

# server configuration
datadir=/data/s1
basedir=/mysql-5.7/

port=3306
socket=/s1.sock

server_id=1
gtid_mode=ON
enforce_gtid_consistency=ON
master_info_repository=TABLE
relay_log_info_repository=TABLE
binlog_checksum=NONE
log_slave_updates=ON
log_bin=binlog
binlog_format=ROW

transaction_write_set_extraction=XXHASH64
group_replication_group_name="aaaaaaaa-aaaa-aaaa-aaaa-aaaaaaaaaaaa"
group_replication_start_on_boot=off
group_replication_local_address= "10.27.139.188:33062"
group_replication_group_seeds= "10.27.139.187:33061,10.27.139.188:33062,10.27.139.189:33063"
group_replication_bootstrap_group=off

转载于:https://www.cnblogs.com/Coye/p/10912768.html

你可能感兴趣的:(MySql 5.7.26 MGR 安装以及配置)