架构

image-yfwA.png

部署

salve端

一、slave服务器安装rsync服务端
1、yum install rsync -y
2、配置文件(vim /etc/rsyncd.conf)
#Rsync server
uid = root
gid = root
use chroot = yes                        
max connections = 20                  
timeout = 900          
pid file =/var/run/rsyncd.pid           
lock file =/var/run/rsync.lock          
log file = /var/log/rsyncd.log
read only = false
list = false
hosts allow = 192.168.88.0/24
hosts deny = *
auth users = rsync_backup
secrets file =/etc/rsync.password

[www] 
path = /data/www/
comment = www 

[bbs]
path = /data/bbs/
comment = bbs

[blog]
path = /data/blog/
comment = blog

3、vim /etc/rsync.password(rsync.password默认没有)
rsync_backup:123456
4、设置权限
chmod 600 /etc/rsync.password

master端

一、master服务器安装sersync+rsync客户端
1、yum install rsync -y
2、vim /etc/rsync.password(rsync.password默认没有)
123456
3、设置权限
chmod 600 /etc/rsync.password
4、tar -zxvf sersync2.5.4_64bit_binary_stable_final.tar.gz -C /usr/local
   mv  GNU-Linux-x86/ sersync
5、修改配置文件
/usr/local/sersync
mv confxml.xml  www.xml
cp www.xml bbs.xml
cp www.xml blog.xml
编辑配置文件修改:
<localpath watch="/opt/tongbu">
            <remote ip="127.0.0.1" name="tongbu1"/>
            <!--<remote ip="192.168.8.39" name="tongbu"/>-->
            <!--<remote ip="192.168.8.40" name="tongbu"/>-->
</localpath>
www修改为:
<localpath watch="/data/www">
            <remote ip="192.168.88.132" name="www"/>
</localpath>
bbs修改为:
<localpath watch="/data/bbs">
            <remote ip="192.168.88.132" name="bbs"/>
</localpath>
blog修改为:
<localpath watch="/data/blog">
            <remote ip="192.168.88.132" name="blog"/>
</localpath>
编辑配置文件每个目录配置文件都修改修改:
<rsync>
            <commonParams params="-artuz"/>
            <auth start="false" users="root" passwordfile="/etc/rsync.pas"/>
            <userDefinedPort start="false" port="874"/><!-- port=874 -->
            <timeout start="false" time="100"/><!-- timeout=100 -->
            <ssh start="false"/>
</rsync>
修改为:
<rsync>
            <commonParams params="-artuz"/>
            <auth start="true" users="rsync_backup" passwordfile="/etc/rsync.password"/>
            <userDefinedPort start="false" port="874"/><!-- port=874 -->
            <timeout start="false" time="100"/><!-- timeout=100 -->
            <ssh start="false"/>
</rsync>