国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁 > 系統 > Windows > 正文

用rsync實現windows與linux文件同步的方法

2019-11-02 16:13:12
字體:
來源:轉載
供稿:網友
windows做為文件服務器,使用rsync的windows服務版本:cwRsyncServer 下載地址:http://rsync.samba.org

安裝過程要設置用于系統服務的帳號和密碼,可以默認。

注:此帳號用于啟用crsync server服務,需要分配給帳號對要同步文件的相應權限,否則無法操作被同步的文件。

安裝完成后修改配置文件 rsyncd.conf, 配置文件內容如下:

復制代碼 代碼如下:

port = 52326

use chroot = false

strict modes = false

#hosts allow = * #允許所有的訪問

hosts allow = 192.168.10.2 #指定特定的IP允許訪問

log file = rsyncd.log

lock file = rsyncd.lock

max connections = 10

UID = 0

GID = 0

# Module definitions

# Remember cygwin naming conventions : c:/work becomes /cygwin/c/work

#

[test]

path = /cygdrive/c/work

read only = false

transfer logging = no

[test2]

path = /cygdrive/d/wwwroot/yanghengfei_com

read only = yes

transfer logging = no

auth users = coldstar #同步使用的帳號

secrets file = rsyncd.secrets #密碼文件

注:

rsyncd.secrets配置文件的格式為 用戶名:密碼,如:

coldstar:123456

即添加了一個用戶 coldstar,密碼為 123456。

Linux服務器上執行同步命令:

rsync -vzrtopg --progress --delete rsync://coldstar@192.168.10.1:52326/test2 /root/test2

然后在password: 提示符下輸入密碼即可。

也可以把密碼寫入配置文件引用,如:

rsync -vzrtopg --progress --delete --password-file=/etc/rsync.pass rsync://coldstar@192.168.10.1:52326/test2 /www/users/yanghengfei_com

將以上命令寫入計劃任務,每1分鐘執行,即可實現實時同步的效果。

注:

上面這個命令行中-vzrtopg里的v是verbose,z是壓縮,r是recursive,topg都是保持文件原有屬性如屬主、時間的參數。-- progress是指顯示出詳細的進度情況,--delete是指如果服務器端刪除了這一文件,那么客戶端也相應把文件刪除,保持真正的一致。

附,rsync使用時的常見問題:

錯誤1: rsync: read error: Connection reset by peer (104)

rsync error: error in rsync protocol data stream (code 12) at io.c(794) [receiver=3.0.2]

解決:很大可能是服務器端沒有開啟 rsync 服務。開啟服務。 或者開啟了防火墻指定的端口無法訪問。

錯誤2:@ERROR: chdir failed

rsync error: error starting client-server protocol (code 5) at main.c(1495) [receiver=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) [receiver=3.0.2]

解決:服務器端配置文件 rsyncd.conf中添加 lock file = rsyncd.lock 即可解決。

錯誤4:@ERROR: invalid uid nobody

rsync error: error starting client-server protocol (code 5) at main.c(1506) [Receiver=3.0.2]

解決:在rsyncd.conf文件中添加下面兩行即可解決問題

UID = 0

GID = 0

錯誤5:@ERROR: auth failed on module test2

rsync error: error starting client-server protocol (code 5) at main.c(1296) [receiver=3.0.2]
發表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發表
主站蜘蛛池模板: 阳城县| 越西县| 颍上县| 木里| 古丈县| 清水县| 嘉善县| 金堂县| 晋江市| 铜鼓县| 温泉县| 夏河县| 抚宁县| 云龙县| 资兴市| 郯城县| 松溪县| 正镶白旗| 大港区| 礼泉县| 蒙山县| 修水县| 耿马| 上蔡县| 新乐市| 山阳县| 洮南市| 临颍县| 贵州省| 游戏| 五原县| 桑日县| 类乌齐县| 新安县| 綦江县| 浙江省| 象州县| 岑巩县| 隆德县| 长汀县| 太保市|