LAMP集群项目五 nfs存储的数据实时同步到backupserver

tar fxzsersync2.5.4_64bit_binary_stable_final.tar.gz -C /usr/local/

mv GNU-Linux-x86 sersync

cp sersync/confxml.xmlsersync/confxml.xml.$(date +%F)

修改配置文件

<localpathwatch="/backup">

             <remoteip="192.168.1.30" name="backup"/>

</localpath>

此步watch="/backup"就是定义服务端待同步的目录

<rsync>

             <commonParamsparams="-artuz"/>

             <auth start="true"users="rsync_backup" passwordfile="/etc/rsync.password"/>

             <userDefinedPortstart="false" port="874"/><!-- port=874 -->

             <timeout start="true" time="100"/><!--timeout=100 -->

             <sshstart="false"/>

        </rsync>

注意修改的配置文件:start  users   passwordfile

提前同步数据

rsync-avzP /backup rsync_backup@192.168.1.30::backup/--password-file=/etc/rsync.password

/application/sersync/sersync2  -d -r -o /application/sersync/confxml.xml

配置sersync环境变量

echo"PATH=$PATH:/usr/local/sersync/">>/etc/profile

source /etc/profile

sersync2

 

working please wait...

execute command: cd /data/www&& rsync -artuz -R --delete ./ --timeout=100 rsync_backup@172.16.1.25::www--password-file=/etc/rsync.password >/dev/null 2>&1

run the sersync:

watch path is: /data/www

表示成功了,tree检查两边的文件是否同步

for n in `seq 10000`;do echo “dddd” > $n.txt;done

压测:写入10K个文件批量同步测试结果:虚拟机上垮掉了

原文地址:https://www.cnblogs.com/taiguyiba/p/6523242.html