sersync+rsync實現實時同步備份
阿新 • • 發佈:2018-06-05
sersync+rsync實現實時同步備
第一個裏程:下載安裝sersync軟件
先進行軟件下載,把軟件包上傳到系統中
unzip sersync_installdir_64bit.zip
cd sersync_installdir_64bit
mv sersync /usr/local/
tree
第二個裏程:編寫sersync配置文件
[root@nfs01 sersync]# cd /usr/local/sersync/conf/
[root@nfs01 conf]# ll
總用量 4
-rw-r--r-- 1 root root 2214 2011-10-26 11:54 confxml.xml
6 <filter start="false">
7 <exclude expression="(.*)\.svn"></exclude>
8 <exclude expression="(.*)\.gz"></exclude>
9 <exclude expression="^info/*"></exclude>
10 <exclude expression="^static/*"></exclude>
11 </filter>
說明:實現同步數據過濾排除功能
12 <inotify> 13 <delete start="true"/> 14 <createFolder start="true"/> 15 <createFile start="false"/> 16 <closeWrite start="true"/> 17 <moveFrom start="true"/> 18 <moveTo start="true"/> 19 <attrib start="false"/> 20 <modify start="false"/> 21 </inotify> 說明:類似於inotify的-e參數功能,指定監控的事件信息 23 <sersync> 24 <localpath watch="/data"> 25 <remote ip="172.16.1.41" name="backup"/> 26 <!--<remote ip="192.168.8.39" name="tongbu"/>--> 27 <!--<remote ip="192.168.8.40" name="tongbu"/>--> 28 </localpath> 29 <rsync> 30 <commonParams params="-az"/> 31 <auth start="true" users="rsync_backup" passwordfile="/etc/rsync.password"/> 32 <userDefinedPort start="false" port="874"/><!-- port=874 --> 33 <timeout start="false" time="100"/><!-- timeout=100 --> 34 <ssh start="false"/> 35 </rsync> 說明:以上內容是數據相關的配置信息,是必須進行修改調整配置 第三個裏程:應用sersync軟件,實現實時同步 [root@nfs01 conf]# cd /usr/local/sersync/ [root@nfs01 sersync]# cd bin/ [root@nfs01 bin]# ll 總用量 1768 -rw-r--r-- 1 root root 1810128 2011-10-26 14:19 sersync sersync命令參數: 參數-d: 啟用守護進程模式 參數-r: 在監控前,將監控目錄與遠程主機用rsync命令推送一遍(測試) 參數-n: 指定開啟守護線程的數量,默認為10個 參數-o: 指定配置文件,默認使用confxml.xml文件 ./sersync -dro /usr/local/sersync/conf/confxml.xml
sersync+rsync實現實時同步備份