Nginx+PHP+MySQL dual-machine mutual backup, fully automatic switching solution

Nginx+PHP+MySQL dual-machine mutual backup, fully automatic switching solution

1. Two-machine mutual backup and automatic switching scheme: 1. Topology: 2. Explanation: (1), assuming that the external network domain name blog.s135.com resolves to the external network virtual IP 72.249.146.214, and the internal network hosts setting db10 corresponds to the internal network virtual IP 192.168.146.214 (2), the default Under normal circumstances, the host is bound to the internal and external network virtual IPs, and the backup machine is used as a backup. When the MySQL, Nginx or server of the host fails to access, the backup machine will automatically take over the internal and external network virtual IPs. Both servers start the daemon process responsible for monitoring and automatically switching virtual IPs /usr/bin/nohup /bin/sh /usr/local/webserver/failover/failover.sh 2>&1 > /dev/null & (3) The MySQL servers on the master and backup machines are master-slave and synchronize with each other. When the host is active (that is, the host binds the virtual IP), read and write the MySQL of the host, and the data written to the host will be synchronized to the standby machine; when the standby is active, read and write the MySQL of the standby, and write to The data of the standby machine will be synchronized to the main machine (if…

Nginx+PHP+MySQL dual-machine mutual backup, fully automatic switching solution

Nginx+PHP+MySQL dual-machine mutual backup, fully automatic switching solution

1. Two-machine mutual backup and automatic switching scheme: 1. Topology: 2. Explanation: (1), assuming that the external network domain name blog.s135.com resolves to the external network virtual IP 72.249.146.214, and the internal network hosts setting db10 corresponds to the internal network virtual IP 192.168.146.214 (2), the default Under normal circumstances, the host is bound to the internal and external network virtual IPs, and the backup machine is used as a backup. When the MySQL, Nginx or server of the host fails to access, the backup machine will automatically take over the internal and external network virtual IPs. Both servers start the daemon process responsible for monitoring and automatically switching virtual IPs /usr/bin/nohup /bin/sh /usr/local/webserver/failover/failover.sh 2>&1 > /dev/null & (3) The MySQL servers on the master and backup machines are master-slave and synchronize with each other. When the host is active (that is, the host binds the virtual IP), read and write the MySQL of the host, and the data written to the host will be synchronized to the standby machine; when the standby is active, read and write the MySQL of the standby, and write to The data of the standby machine will be synchronized to the main machine (if…

Nginx+PHP+MySQL dual-machine mutual backup, fully automatic switching solution

Nginx+PHP+MySQL dual-machine mutual backup, fully automatic switching solution

Full series of PHP video tutorials: Detailed PHP – http://www.xishuophp.com/ In production applications, a certain “Nginx+PHP+MySQL” interface data server plays a very important role. If the server is hard software or Nginx, MySQL failure, and a short time If it cannot be recovered internally, the consequences will be very serious. In order to avoid a single point of failure, I designed this solution, wrote the failover.sh script, and realized Dual-machine mutual backup, fully automatic switching, and the failover time only takes a few seconds ten seconds. 1. Two-machine mutual backup and fully automatic switching scheme: 1. Topology map: 2. Explanation: (1), assuming that the external network domain name blog.zyan.cc is resolved to the external network virtual IP 72.249.146.214, and the internal network hosts are set to db10 corresponding to the internal network Virtual IP 192.168.146.214 (2) By default, the host is bound to the internal and external network virtual IPs, and the standby machine is used as a backup. When MySQL, Nginx or the server of the host fails In case of inaccessibility due to failure, the standby machine will automatically take over the internal and external network Virtual IP. Both servers start the daemon process /usr/bin/nohup /bin/sh responsible for…

Contact Us

Contact us

181-3619-1160

Online consultation: QQ交谈

E-mail: [email protected]

Working hours: Monday to Friday, 9:00-17:30, holidays off

Follow wechat
Scan wechat and follow us

Scan wechat and follow us

Follow Weibo
Back to top
首页
微信
电话
搜索