MYSQL 双主搭建
作者:互联网
参考 mysql搭建安装完mysql后
https://blog.51cto.com/popli3/2357211
在master上:
- 打开log-bin和server-id=1选项
[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在slave 上:
- 打开server-id=2和log-bin
[root@minion-2 ~]# vi /etc/my.cnf
log-bin
server-id=2 - 进入change master 功能
mysql>change master to master_host='192.168.0.104',master_user='slave',master_password='slave';
mysql> start slave;
至此单向的主从完毕,接下来是反过来操作一遍
在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;
标签:slave,minion,MYSQL,192.168,id,master,mysql,双主,搭建 来源: https://blog.51cto.com/popli3/2370453