mysql5.7安装以及mgr搭建

yum 安装MySQL 5.7的方法

rpm  -ivh https://repo.mysql.com//yum/mysql-5.7-community/el/7/x86_64/mysql57-community-release-el7-10.noarch.rpm #CentOS 7版本下载
yum list  #刷新yum 源缓存。
yum -y install mysql-community-server   #安装MySQL 5.7。
systemctl start mysqld      #启动MySQL会生成临时密码。
echo “validate-password=OFF”/etc/my.cnf #关闭密码验证
修改域名解析及主机名
echo -e "10.0.0.11 yundd11\n10.0.0.12 yundd12\n10.0.0.13 yundd13">>/etc/hosts
echo "yunddxx">>/etc/hostname

修改配置文件

vim /etc/my.cnf
[mysqld] 
datadir=/var/lib/mysql
socket=/var/lib/mysql/mysql.sock
symbolic-links=0
log-error=/var/log/mysqld.log
pid-file=/var/run/mysqld/mysqld.pid
validate-password=OFF

server_id = 100         
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
loose-group_replication_group_name = 'ce9be252-2b71-11e6-b8f4-00212844f856'
loose-group_replication_start_on_boot = off
loose-group_replication_local_address = 'yundd11:33061'
loose-group_replication_group_seeds = 'yundd11:33061,yundd12:33062,yundd13:33063'
loose-group_replication_bootstrap_group = off
systemctl restart mysqld

建立复制账号

mysql -u root -p123456
set SQL_LOG_BIN=0; #停止日志记录
grant replication slave on *.* to repl@'10.0.0.%' identified by '123456'; 
flush privileges;
set SQL_LOG_BIN=1; #开启日志记录
change master to master_user='repl',master_password='123456'  for channel 'group_replication_recovery'; #构建group replication集群
install PLUGIN group_replication SONAME 'group_replication.so'; #安装group replication插件
set global group_replication_bootstrap_group=on; #开启标示以后加入集群的服务器以这台服务器为基准,以后加入的就不需要设置。 
start group_replication;
set global group_replication_bootstrap_group=off;
select * from performance_schema.replication_group_members; #-- 查询表
show variables like 'group_replication%';

其它节点与首节点配置文件的区别

********
    server_id = 100
    loose-group_replication_local_address = 'yundd11:33061'
********

********
    第一台节点开启引导set global group_replication_bootstrap_group=on;
    节点加入组set global group_replication_allow_local_disjoint_gtids_join=ON;
********

你可能感兴趣的:(mysql5.7安装以及mgr搭建)