MySQL Group Replication mgr 安装关键过程

1、初始化和启动

mysql/bin/mysqld --initialize-insecure --basedir=/mgr/mysql --datadir=/mgr/data/s1
mysql/bin/mysqld --initialize-insecure --basedir=/mgr/mysql --datadir=/mgr/data/s2
mysql/bin/mysqld --initialize-insecure --basedir=/mgr/mysql --datadir=/mgr/data/s3

/mgr/mysql/bin/mysqld --defaults-file=/mgr/data/s1/s1.cnf
/mgr/mysql/bin/mysqld --defaults-file=/mgr/data/s2/s2.cnf
/mgr/mysql/bin/mysqld --defaults-file=/mgr/data/s3/s3.cnf

2、配置文件具体内

s1:

[mysqld]

# server configuration
datadir=/mgr/data/s1
basedir=/mgr/mysql/
user=mysql
port=24801
socket=/mgr/data/s1/s1.sock

#disabled_storage_engines="MyISAM,BLACKHOLE,FEDERATED,ARCHIVE,MEMORY"

#Replication Framework
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

#Group Replication Settings

transaction_write_set_extraction=XXHASH64
loose-group_replication_group_name="5c7975ec-0000-11e9-a8c9-0800273906ff"
loose-group_replication_start_on_boot=off
loose-group_replication_local_address= "127.0.0.1:24901"
loose-group_replication_group_seeds= "127.0.0.1:24901,127.0.0.1:24902,127.0.0.1:24903"
loose-group_replication_bootstrap_group=off

s2:

[mysqld]

# server configuration
datadir=/mgr/data/s2
basedir=/mgr/mysql/
user=mysql
port=24802
socket=/mgr/data/s2/s2.sock

#disabled_storage_engines="MyISAM,BLACKHOLE,FEDERATED,ARCHIVE,MEMORY"

#Replication Framework
server_id=2
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

#Group Replication Settings

transaction_write_set_extraction=XXHASH64
loose-group_replication_group_name="5c7975ec-0000-11e9-a8c9-0800273906ff"
loose-group_replication_start_on_boot=off
loose-group_replication_local_address= "127.0.0.1:24902"
loose-group_replication_group_seeds= "127.0.0.1:24901,127.0.0.1:24902,127.0.0.1:24903"
loose-group_replication_bootstrap_group=off

s3:
[mysqld]

# server configuration
datadir=/mgr/data/s3
basedir=/mgr/mysql/
user=mysql
port=24803
socket=/mgr/data/s3/s3.sock

#disabled_storage_engines="MyISAM,BLACKHOLE,FEDERATED,ARCHIVE,MEMORY"

#Replication Framework
server_id=3
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

#Group Replication Settings

transaction_write_set_extraction=XXHASH64
loose-group_replication_group_name="5c7975ec-0000-11e9-a8c9-0800273906ff"
loose-group_replication_start_on_boot=off
loose-group_replication_local_address= "127.0.0.1:24903"
loose-group_replication_group_seeds= "127.0.0.1:24901,127.0.0.1:24902,127.0.0.1:24903"
loose-group_replication_bootstrap_group=off

3、登录MySQL执行命令

s1必要过程
mysql> SET SQL_LOG_BIN=0;
mysql> CREATE USER [email protected]‘%‘ IDENTIFIED BY ‘password‘;
mysql> GRANT REPLICATION SLAVE ON *.* TO [email protected]‘%‘;
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‘;
mysql> INSTALL PLUGIN group_replication SONAME ‘group_replication.so‘;
mysql> SET GLOBAL group_replication_bootstrap_group=ON;
mysql> START GROUP_REPLICATION;
mysql> SET GLOBAL group_replication_bootstrap_group=OFF;
s1非必要过程
mysql> SELECT * FROM performance_schema.replication_group_members;
mysql> SHOW PLUGINS;
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‘);
mysql> SELECT * FROM t1;
mysql> SHOW BINLOG EVENTS;
mysql> exit

s2必要过程

mysql> SET SQL_LOG_BIN=0;
mysql> CREATE USER [email protected]‘%‘ IDENTIFIED BY ‘password‘;
mysql> GRANT REPLICATION SLAVE ON *.* TO [email protected]‘%‘;
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‘;
mysql> INSTALL PLUGIN group_replication SONAME ‘group_replication.so‘;
mysql> SELECT * FROM performance_schema.replication_group_members;
mysql> START GROUP_REPLICATION;
mysql> SELECT * FROM performance_schema.replication_group_members;
mysql> show variables like ‘%read_only%‘;

s3必要过程

mysql> SET SQL_LOG_BIN=0;
mysql> CREATE USER [email protected]‘%‘ IDENTIFIED BY ‘password‘;
mysql> GRANT REPLICATION SLAVE ON *.* TO [email protected]‘%‘;
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‘;
mysql> INSTALL PLUGIN group_replication SONAME ‘group_replication.so‘;
mysql> SELECT * FROM performance_schema.replication_group_members;
mysql> START GROUP_REPLICATION;
mysql> SELECT * FROM performance_schema.replication_group_members;
mysql> show variables like ‘%read_only%‘;

4、遇到问题

问题1
[ERROR] unknown variable ‘group_replication_group_name=5c7975ec-0000-11e9-a8c9-0800273906ff‘
原参数
group_replication_group_name="5c7975ec-0000-11e9-a8c9-0800273906ff"
group_replication_start_on_boot=off
group_replication_local_address= "127.0.0.1:24903"
group_replication_group_seeds= "127.0.0.1:24901,127.0.0.1:24902,127.0.0.1:24903"
group_replication_bootstrap_group=off
修改后参数
loose-group_replication_group_name="5c7975ec-0000-11e9-a8c9-0800273906ff"
loose-group_replication_start_on_boot=off
loose-group_replication_local_address= "127.0.0.1:24903"
loose-group_replication_group_seeds= "127.0.0.1:24901,127.0.0.1:24902,127.0.0.1:24903"
loose-group_replication_bootstrap_group=off

问题2创建的复制用户和使用的复制用户不一致
mysql> SELECT * FROM performance_schema.replication_group_members;
+---------------------------+--------------------------------------+-------------+-------------+--------------+
| CHANNEL_NAME              | MEMBER_ID                            | MEMBER_HOST | MEMBER_PORT | MEMBER_STATE |
+---------------------------+--------------------------------------+-------------+-------------+--------------+
| group_replication_applier | 5c7975ec-a9cd-11e9-a8c9-0800273906ff | mgr1        |       24801 | ONLINE       |
| group_replication_applier | 69908c35-a9cd-11e9-8b78-0800273906ff | mgr1        |       24802 | RECOVERING   |
+---------------------------+--------------------------------------+-------------+-------------+--------------+
原:
CHANGE MASTER TO MASTER_USER=‘repli‘, MASTER_PASSWORD=‘[email protected]%‘ FOR CHANNEL ‘group_replication_recovery‘;
修改后,要和创建的复制用户一致
CHANGE MASTER TO MASTER_USER=‘rpl_user‘, MASTER_PASSWORD=‘password‘ FOR CHANNEL ‘group_replication_recovery‘;

问题3 未执行START GROUP_REPLICATION; 新加入节点显示offline
mysql> SELECT * FROM performance_schema.replication_group_members;
+---------------------------+-----------+-------------+-------------+--------------+
| CHANNEL_NAME              | MEMBER_ID | MEMBER_HOST | MEMBER_PORT | MEMBER_STATE |
+---------------------------+-----------+-------------+-------------+--------------+
| group_replication_applier |           |             |        NULL | OFFLINE      |
+---------------------------+-----------+-------------+-------------+--------------+
1 row in set (0.00 sec)
执行后
mysql> START GROUP_REPLICATION;
Query OK, 0 rows affected (3.47 sec)

mysql> SELECT * FROM performance_schema.replication_group_members;
+---------------------------+--------------------------------------+-------------+-------------+--------------+
| CHANNEL_NAME              | MEMBER_ID                            | MEMBER_HOST | MEMBER_PORT | MEMBER_STATE |
+---------------------------+--------------------------------------+-------------+-------------+--------------+
| group_replication_applier | 5c7975ec-a9cd-11e9-a8c9-0800273906ff | mgr1        |       24801 | ONLINE       |
| group_replication_applier | 69908c35-a9cd-11e9-8b78-0800273906ff | mgr1        |       24802 | ONLINE       |
| group_replication_applier | 79ca1c48-a9cd-11e9-9526-0800273906ff | mgr1        |       24803 | ONLINE       |
+---------------------------+--------------------------------------+-------------+-------------+--------------+
3 rows in set (0.00 sec)

原文地址:https://blog.51cto.com/860143/2421692

时间: 2024-10-09 15:54:05

MySQL Group Replication mgr 安装关键过程的相关文章

MySQL Group Replication mgr 单主 proxysql 读写分离配置过程

1.前期准备,mgr安装见上一篇文章 2.创建用户和导入脚本 GRANT ALL ON *.* TO 'rootuser'@'%' IDENTIFIED BY '123456'; /mgr/mysql/bin/mysql -h127.0.0.1 -P24802 <a.sql [[email protected] ~]# cat a.sql USE sys; DELIMITER $$ CREATE FUNCTION IFZERO(a INT, b INT) RETURNS INT DETERMIN

MySQL Group Replication的安装部署

一.简介 这次给大家介绍下MySQL官方最新版本5.7.17中GA的新功能 Group Replication . Group Replication是一种可用于实现容错系统的技术.复制组是一组通过消息传递相互交互的服务器.通信层提供一组保证,例如原子消息和总订单消息传递.这些是非常强大的属性,可以转化为非常有用的抽象,人们可以诉诸构建更高级的数据库复制解决方案.MySQL组复制构建在这些属性和抽象之上,并实现多主复制协议的更新.实质上,复制组由多个服务器形成,并且组中的每个服务器可以独立地执行

Mysql Group Replication 简介及单主模式组复制配置【转】

一 Mysql Group Replication简介 Mysql Group Replication(MGR)是一个全新的高可用和高扩张的MySQL集群服务. 高一致性,基于原生复制及paxos协议的组复制技术,以插件方式提供一致数据安全保证: 高容错性,大多数服务正常就可继续工作,自动不同节点检测资源征用冲突,按顺序优先处理,内置自动防脑裂机制: 高扩展性,自动添加移除节点,并更新组信息: 高灵活性,单主模式和多主模式.单主模式自动选主,所有更新操作在主进行:多主模式,所有server同时更

MySQL Group Replication调研剖析

一.MySQL复制的三种模式 MySQL当前存在的三种复制模式有:异步模式.半同步模式和组复制模式,先了解一下三种模式的工作方式. 1.MySQL Asynchronous Replication(异步复制) 异步复制是MySQL最早的也是当前使用最多的复制模式,异步复制提供了一种简单的主-从复制方法,包含一个主库(master)和备库(一个,或者多个)之间,主库执行并提交了事务,在这之后(因此才称之为异步),这些事务才在从库上重新执行一遍(基于statement)或者变更数据内容(基于row)

MySQL group replication介绍

"MySQL group replication" group replication是MySQL官方开发的一个开源插件,是实现MySQL高可用集群的一个工具.第一个GA版本正式发布于MySQL5.7.17中:想要使用group replication只需要从官网上下载MySQL5.7.17及以后的版本即可 group replication发布以后,有3种方法来实现MySQL的高可用集群: ①:异步复制 ②:半同步复制 ③:group replication ---注意: 异步复制是

Mysql Group Replication 简析

前段时间做了组内分享,写的关于mysql Group Replication 文章   3, 高扩展 原文地址:https://www.cnblogs.com/yhdgm/p/8124719.html

Percona XtraDB Cluster vs Galera Cluster vs MySQL Group Replication

Overview Galera Cluster Percona XtraDB Cluster MySQL Group Replication MySQL InnoDB Cluster Similarities Similar - Use Cases Similar Limitation Differences GR & Galera Group Communication System 组通信系统 Binlogs & Gcache Node Provisioning 节点配置 GTID v

实践 Mysql Group Replication 组复制

实践过程: 在一台服务器上安装3个MySQL(s1,s2,s3) 配置s1,启动 Group Replication 配置s2,添加到组中 配置s3,添加到组中 测试 内容比较长,可能不方便实际操作,我也做了一个PDF版本,您可以下载查看,发送消息 'gr' 会自动回复下载地址 详细配置过程 (1)下载 mysql-5.7.17 https://cdn.mysql.com//Downloads/MySQL-5.7/mysql-5.7.17-linux-glibc2.5-x86_64.tar.gz

MySQL Group Replication

group replication是一种全新的高可用,高扩张的MySQL集群服务.高一致性,基于原生复制及paxos协议的组复制技术,以插件方式提供一致数据安全保证:高容错性,大多数服务正常就可继续工作,自动不同节点检测资源征用冲突,按顺序优先处理,内置自动防脑裂机制:高扩展性,自动添加移除节点,并更新组信息:高灵活性,单主模式和多主模式.单主模式自动选主,所有更新操作在主进行:多主模式,所有server同时更新. 0,修改hostsvim /etc/hostslocalhost 127.0.0