rsync(remote sync)是類 Unix 系統的資料鏡像備份神器,Windows 移植版 cwRsync 同樣強大。特性:保留權限、時間、軟硬連結;傳輸效率高;支援 SSH、Socket、匿名傳輸。本文詳解 Windows 2003 環境下 Server/Client 端安裝、配置、測試與常見問題。
cwRsync_2.0.10_Installer(Client)、cwRsync_Server_2.0.10_Installer(Server)Server 端運行 cwRsync_Server_2.0.10_Installer,Client 端運行 cwRsync_2.0.10_Installer,步驟一致,一路下一步。
rsyncd.confpid file = /var/run/rsyncd.pid
lock file = /var/run/rsync.lock
log file = /var/log/rsyncd.log
uid = administrator
gid = administrator
use chroot = no
max connections = 4
syslog facility = local5
[test]
path = /cygdrive/d/wlk
comment = BACKUP CLIENT IS SOLARIS 8 E250
ignore errors
read only = yes
list = no
auth users = inburst
secrets file = etc/inburst.pas
etc/inburst.pas:inburst:hackRsyncServer 並設為自動。rsync -av 10.0.0.16::401 /cygdrive/h/401
參數解析:-v 詳細、-z 壓縮、-r 遞歸、-topg 保留屬性、--progress 顯示進度、--delete 刪除異步檔案。可加 -e ssh 加密傳輸,--password-file 實現腳本無交互驗證(注意權限 600)。
identity.pub 到 Server B ~/.ssh/authorized_keys。--backup-dir=./backup-$(date +%F)。--port 8730 或 -e 'ssh -p 2002'。rsync -av --include '*/' --exclude '*' src/ dest/。read only = no。nobody 組,改 gid = nogroup。--port 改端口。rsync -a user@host::module dest。cwRsync_Server,啟動 opensshd 服務。C:/Program Files/cwRsyncServer/rsyncd.conf:
use chroot = false
strict modes = false
hosts allow = *
log file = rsyncd.log
pid file = rsyncd.pid
[rsync]
path = /cygdrive/f/rsync
read only = yes
transfer logging = yes
secrets file = /cygdrive/f/rsyncd.secrets
RsyncServer 服務。cwRsync_Client。telnet 192.168.0.201 22、telnet 192.168.0.201 873。rsync -vzrtopg --progress --delete 192.168.0.201::rsync /cygdrive/d/test(輸入 administrator 密碼)。至此,Windows 雙機 rsync 同步環境搭建完成。