Group Replication 环境搭建


Group Replication 环境搭建

基本环境

类型 说明
操作系统 Linux version 3.10.0-693.el7.x86_64
MySQL 版本 mysql/mysql-5.7.23-linux 64 位

部署规划

本次部署为多机单实例
basedir

/usr/local/mysql
IP 端口号 数据目录 group_replication 通信端口
172.18.0.11 3306 /data/mgr/mysql3306{data,logs,tmp} 23306
172.18.0.12 3306 /data/mgr/mysql3306{data,logs,tmp} 23306
172.18.0.13 3306 /data/mgr/mysql3306{data,logs,tmp} 23306

基本初始化

解压 MySQL

# cd /opt/mysql/
# tar zxvf /path/mysql-5.7.25-linux-glibc2.12-x86_64.tar.gz 
# ln -s /opt/mysql/mysql-5.7.25-linux-glibc2.12-x86_64.tar.gz mysql

添加 mysql 用户

# groupadd mysql
# useradd -g mysql  -d /usr/local/mysql -s /sbin/nologin -MN mysql
更改 mysql 目录权限
# chown -R mysql:mysql mysql/

创建数据库数据目录

在三个服务器上都创建这样的目录

# mkdir -p mgr/mysql3306/{data,logs,tmp}
更改目录权限
# chown -R mysql:mysql mgr

基本安装

配置文件说明

IP 端口号 配置文件
172.18.0.11 3306 /data/mgr/mysql3306/my3306.cnf
172.18.0.12 3306 /data/mgr/mysql3306/my3306.cnf
172.18.0.13 3306 /data/mgr/mysql3306/my3306.cnf

配置文件中注意参数

#group replication
gtid_mode=ON
enforce_gtid_consistency=ON

master_info_repository=TABLE
relay_log_info_repository=TABLE

binlog_checksum=NONE
log_slave_updates=ON
binlog_format=ROW

transaction_write_set_extraction=XXHASH64
loose-group_replication_group_name="3db33b36-0e51-409f-a61d-c99756e90155"
loose-group_replication_start_on_boot=off
loose-group_replication_local_address= "172.18.0.11:23306"
loose-group_replication_group_seeds= "172.18.0.11:23306,172.18.0.12:23307,172.18.0.13:23308"
loose-group_replication_bootstrap_group= off

## configure single-master OR multi-master
#loose-group_replication_single_primary_mode=off
#loose-group_replication_enforce_update_everywhere_checks=on
重要参数说明
group_replication_group_name

The name of the group which this server instance belongs to. Must be a valid UUID. This UUID is used internally when setting GTIDs for Group Replication events in the binary log.

Important

A unique UUID must be used.

可在命令行中通过 uuidgen 生成唯一的 UUID

# uuidgen
621f32ad-54e2-4f43-93b9-5808f463b931
group_replication_start_on_boot

Whether the server should start Group Replication or not during server start.

将 group_replication_start_on_boot 设置为 off,尽量手动操作集群节点的加入

group_replication_local_address

The network address which the member provides for connections from other members, specified as a host:port formatted string. This address must be reachable by all members of the group because it is used by XCOM, the internal group communication system.

Warning

Do not use this address for communication with the member.

Other Group Replication members contact this member through this host:port for all internal group communication. This is not the MySQL server SQL protocol host and port.

group_replication_group_seeds

A list of group members that provide a member which joins the group with the data required for the joining member to gain synchrony with the group. The list consists of the seed member’s network addresses specified as a comma separated list, such as host1:port1,host2:port2.

Important

These addresses must not be the member’s SQL hostname and port.

Usually this list consists of all members of the group, but you can choose a subset of the group members to be seeds. The list must contain at least one valid member address. Each address is validated when starting Group Replication. If the list does not contain any valid host names, issuing START GROUP_REPLICATION fails.

group_replication_bootstrap_group

Configure this server to bootstrap the group. This option must only be set on one server and only when starting the group for the first time or restarting the entire group. After the group has been bootstrapped, set this option to OFF. It should be set to OFF both dynamically and in the configuration files. Starting two servers or restarting one server with this option set while the group is running may lead to an artificial split brain situation, where two independent groups with the same name are bootstrapped.

group_replication_single_primary_mode

Instructs the

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值