时间:2021-07-01 10:21:17 帮助过:19人阅读
服务器A | 服务器B |
---|---|
192.168.0.104 | 192.168.0.105 |
[root@minion-2 ~]# vi /etc/my.cnf
log-bin
server-id=1
mysql> grant super,reload,replication slave on *.* to slave@192.168.0.105 identified by ‘slave‘;
mysql> flush privileges;
mysql>quit
[root@minion-2 ~]# service mysqld restart
[root@minion-2 ~]# vi /etc/my.cnf
log-bin
server-id=2
mysql>change master to master_host=‘192.168.0.104‘,master_user=‘slave‘,master_password=‘slave‘;
mysql> start slave;
至此单向的主从完毕,接下来是反过来操作一遍
mysql> grant super,reload,replication slave on *.* to slave@192.168.0.104 identified by ‘slave‘;
mysql> flush privileges;
mysql>change master to master_host=‘192.168.0.105‘,master_user=‘slave‘,master_password=‘slave‘;
mysql> start slave;
MYSQL 双主搭建
标签:super etc pop 服务 ice tps load ati my.cnf