mysql单机多实例(三实例)安装及mgr集群部署

mysql单机多实例(三实例)安装及mgr集群部署

--安装mgr插件
install PLUGIN group_replication SONAME 'group_replication.so';

--初始化数据目录,--defaults-file参数一定要放在最前面
mysqld --defaults-file=/data/3306/my3306.cnf --initialize --user=mysql
A temporary password is generated for root@localhost: >16-j%4lqoN_

mysqld --defaults-file=/data/3307/my3307.cnf --initialize --user=mysql
A temporary password is generated for root@localhost: jT+7Blb-zCa.

mysqld --defaults-file=/data/3308/my3308.cnf --initialize --user=mysql
A temporary password is generated for root@localhost: h!YO+V=g?00r

--启动实例
mysqld_safe --defaults-file=/data/3306/my3306.cnf --user=mysql &
mysqld_safe --defaults-file=/data/3307/my3307.cnf --user=mysql &
mysqld_safe --defaults-file=/data/3308/my3308.cnf --user=mysql &


--登录实例
mysql --defaults-file=/data/3306/my3306.cnf -uroot -ppassword

mysql --defaults-file=/data/3307/my3307.cnf -uroot -ppassword

mysql --defaults-file=/data/3308/my3308.cnf -uroot -ppassword


--关闭实例
mysqladmin --defaults-file=/data/3308/my3308.cnf -uroot -ppassword shutdown

mysqladmin --defaults-file=/data/3307/my3307.cnf -uroot -ppassword shutdown

mysqladmin --defaults-file=/data/3306/my3306.cnf -uroot -ppassword shutdown

--mgr配置搭建
--3306
SET GLOBAL group_replication_bootstrap_group=ON;
create user 'mgr_rep'@'%' identified by 'password';
grant REPLICATION SLAVE on *.* to 'mgr_rep'@'%' with grant option;
reset master;
CHANGE MASTER TO MASTER_USER='mgr_rep', MASTER_PASSWORD='password' FOR CHANNEL 'group_replication_recovery';
start group_replication;
SELECT * FROM performance_schema.replication_group_members;


--slave启动时,set global group_replication_allow_local_disjoint_gtids_join=ON;
--以上参数不需要,group_name集群的每个节点要保持一致
--多实例安装后,字符集就不全为utf8了,需解决?

参考文档

mysql8.0初探:(二)MySQL Group Replication-MGR集群简介

MySQL Group Replication的安装部署

猜你喜欢

转载自www.cnblogs.com/sorliran/p/9667655.html