今天剛接觸到rsync這支程式,發現超好用的安裝方式如下以下摘錄官網文章:
http://www.itefix.no/phpws/index.php?module=faq&FAQ_op=view&FAQ_id=55

當rsync Server(也就是 Backup Server),備份主機會開啟一個 873 的por)
等待rsync client連接,連接時rsync Server會檢查密碼是否正確若通過密碼查核,
便開始進行檔案傳輸,第一次連通會把整份檔案傳輸一次,下一次就只傳送資料之間異動的部份。


Step1.

以下介紹如何安裝設定備份程式(因為SSH傳輸要加密很慢所以就不用SSH方式備份)

CWRSYNC_SERVER :

- Install cwRsync Server without openssh component
- Start RsyncServer services
- Use Prep a Dir for Upload wizard for the directory d:\backup
- Edit  rsyncd.conf (開始->程式集>cwRsync):

            use chroot = false
            strict modes = false
            hosts allow = *
            log file = rsyncd.log
            pid file = rsyncd.pid

# Module definitions
# Remember cygwin naming conventions : c:\work becomes /cygwin/c/work
#

 [backup]
secrets file = /cygdrive/c/rsyncd.secrets  #密碼檔的位置
path = /cygdrive/d/ukdata
read only = false
transfer logging = yes

PS .  
      1. rsync 是走 873/TCP    port所有防火牆要打開 
      2.安裝成service重開機會自動啟動 
          c:\program file\cwrsyncserver\setperms --config rsyncd.conf --daemon --no-detach
 


Step2.

W_RSYNC_CLIENT :

- Install cwRsync with Secure Channel Wrapper

將client端batch檔存成.bat檔用win內建排程定時去Run就好了
rsync -avrtzu -P  --delete --password-file=c:\rsyncd.secrets @Remote Server IP::backup /cygdrive/D/data

Remote Server IP: <--設定你rsync Server的IP address

(常用參數) —> 說明


 -a,—archive

  • archive mode, equivalent to –rlptgoD,檔案模式

 —v,—verbose

  • increase verbosity,觀看過程

 —z,—compress

  • compress file data,壓縮資料

 —P

  • equivalent to—partial—progress,顯示程序進度%

 —delete

  • delete files that don’t exist on the sending side,當source端刪除A文件則destination端也把A文件刪除保持二台機器資料的一致性。
創作者介紹
創作者 Lance's Tech Book 的頭像
lance1120

Lance's Tech Book

lance1120 發表在 痞客邦 留言(0) 人氣( 1041 )