网络通信 频道

Nginx+PHP+MySQL双机互备、全自动切换方案

  二、配置文档与脚本:
  1、主机、备机两台服务器的rsync配置(配置相同)
  (1)、rsync配置文件
vi /etc/rsyncd.conf

  输入一些内容并保存:
引用
uid = root
gid = root
use chroot = no
max connections = 20
pid file = /var/run/rsyncd.pid
lock file = /var/run/rsync.lock
log file = /var/log/rsyncd.log

[data0_htdocs]
path = /data0/htdocs/
ignore errors
read only = no
hosts allow = 192.168.146.0/24
hosts deny = 0.0.0.0/32

[php_etc]
path = /usr/local/webserver/php/etc/
ignore errors
read only = no
hosts allow = 192.168.146.0/24
hosts deny = 0.0.0.0/32

[nginx_conf]
path = /usr/local/webserver/nginx/conf/
ignore errors
read only = no
hosts allow = 192.168.146.0/24
hosts deny = 0.0.0.0/32


  (2)、启动rsync守护进程
/usr/bin/rsync --daemon

0
相关文章