美文网首页
mysqlshell 搭建 MGR

mysqlshell 搭建 MGR

作者: 芒果之夏 | 来源:发表于2020-04-28 03:36 被阅读0次

0、背景

本实验为3节点架构,ip及主机名,且都安装了MySQL

Host Port Hostname
172.16.215.201 3306 db201
172.16.215.202 3306 db202
172.16.215.203 3306 db203

1、主机配置(3个节点均操作)

vim /etc/hosts

127.0.0.1  localhost
172.16.215.201 db201
172.16.215.202 db202
172.16.215.203 db203

2、数据库配置(3个节点均操作)

set sql_log_bin=0;
set global super_read_only=0;
set global read_only=0;
alter user current_user() identified by 'a';
create user 'repl'@'%' identified by 'a';
grant replication slave on . to 'repl'@'%';
set sql_log_bin=1;

3、在主节点创建MGR(我的环境是db201已安装mysqlshell)

[root@db201 ~]# mysqlsh -urepl -pa -P3306
var c = dba.createCluster('myCluster')
c.addInstance('repl@db202:3306')
c.addInstance('repl@db203:3306')
c.status()

相关文章

网友评论

      本文标题:mysqlshell 搭建 MGR

      本文链接:https://www.haomeiwen.com/subject/thlmwhtx.html