MySQL主从复制(一主两从)

Posted Room、C

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了MySQL主从复制(一主两从)相关的知识,希望对你有一定的参考价值。

 

 

设备:

master:192.168.200.125

slave:192.168.200.124

slave:192.168.200.111

 

Master操作:

关闭防火墙:

[root@localhost ~]# systemctl stop firewalld
[root@localhost ~]# iptables -F
[root@localhost ~]# setenforce 0

安装ntp时间同步软件:主要为了让主服务器和从服务器之间时间一致。那么从服务器中继日志和主的二进制日志数据一致

[root@localhost ~]# yum install ntp -y

[root@localhost ~]# vim /etc/ntp.conf 

在末尾加入如下两行:主要让自己变成ntp的服务端使得从服务器能获取主服务器的时间

server 127.127.1.0 fudge 127.127.1.0 stratum 8

启动NTP服务:

[root@localhost ~]# systemctl start ntpd
[root@localhost ~]# systemctl enable ntpd

 

 

 

 

Slave操作:两台从操作一致

关闭防火墙:

[root@localhost ~]# systemctl stop firewalld
[root@localhost ~]# iptables -F
[root@localhost ~]# setenforce 0

安装ntpdate:

[root@localhost ~]# yum install ntpdate -y

 

以上是关于MySQL主从复制(一主两从)的主要内容,如果未能解决你的问题,请参考以下文章