cwrsync 四步實現windows備份
2024-09-10 00:05:52
供稿:網友
服務器端:
http://rsync.samba.org/ 服務器端(cwRsyncServer)。
安裝目錄: E:/cwRsyncServer
端口: 52326
ip: 219.152.120.82
一:修改cwRsyncServer配置文件 E:/cwRsyncServer/rsyncd.conf
#########
port = 52326
use chroot = false
strict modes = false
read only = yes
list = no
hosts allow = *
max connections = 10
secrets file = rsyncd.secrets #指定用戶登錄的密碼文件
motd file = rsyncd.motd #連接上rsync server時顯示的歡迎信息
log file = rsyncd.log
pid file = rsyncd.pid
transfer logging = yes
# Module definitions
# Remember cygwin naming conventions : c:/work becomes /cygwin/c/work
#
[test]
path = /cygdrive/c/work
read only = false
transfer logging = yes
[t_task]
path = /cygdrive/c/work
read only = false
transfer logging = yes
#################################
二:在E:/cwRsyncServer目錄下新建密碼文件 rsyncd.secrets 內容為用戶名:密碼
如: tly:fjs249slke
客戶端:
http://rsync.samba.org/ 下載cwRsync客戶端(cwRsync)
安裝目錄: E:/cwRsync
三:在E:/cwRsyncServer目錄下新建密碼文件 rsyncd.secrets 內容為密碼
如:fjs249slke
四:開始–>運行–>cmd 輸入以下命令即可同步服務器端t_task模塊到客戶端e:/y目錄下。
E:/cwRsync/bin/rsync.exe -vazu –exclude article/ –progress –delete –
password-file=E:/cwRsync/rsyncd.secrets
rsync://odinxu@219.152.120.82:52326/t_task /cygdrive/e/y
照做可同步服務了,如果不行,1.檢查服務器是否有開服務端口,命令行輸入( netstat -a ) 可查看服務器開的端口。就是上面的52326端口。2.客戶端命令行輸入( telnet 服務端ip 服務端口 ) 能否連接服務器端。3.檢查配置文件是否跟上面一樣。
注:以上為匿名連接入服務器端,一般會在模塊里添加 auth user= odinxu 指定用戶,一定要注意,指定的用戶必須要登陸才能進行同步服務。 我在這里掐了很久,模塊里指定了用戶,用戶又沒有登陸,導致出錯。
新手常出現的錯誤:
錯誤1: rsync: read error: Connection reset by peer (104)
rsync error: error in rsync protocol data stream (code 12) at io.c(794) [receive
r=3.0.2]
解決:很大可能是服務器端沒有開啟 rsync 服務。開啟服務。
錯誤2:@ERROR: chdir failed
rsync error: error starting client-server protocol (code 5) at main.c(1495) [rec
eiver=3.0.2]
解決:服務器端同步目錄沒有權限,cwrsync默認用戶是Svcwrsync。為同步目錄添加用戶Svcwrsync權限。
錯誤3:@ERROR: failed to open lock file
rsync error: error starting client-server protocol (code 5) at main.c(1495) [rec
eiver=3.0.2]
解決:配置文件 rsync.conf中添加 lock file = rsyncd.lock 即可解決。
更具體的實現方法可以參考://www.49028c.com/article/19663.htm