0、背景
本實驗為3節(jié)點架構(gòu),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個節(jié)點均操作)
vim /etc/hosts
127.0.0.1 localhost
172.16.215.201 db201
172.16.215.202 db202
172.16.215.203 db203
2、數(shù)據(jù)庫配置(3個節(jié)點均操作)
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、在主節(jié)點創(chuàng)建MGR(我的環(huán)境是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()