1. 程式人生 > 實用技巧 >記linux與Windows之間實現檔案實時同步的方案

記linux與Windows之間實現檔案實時同步的方案

近日,資料分析部提了個需求說要讓一臺linux的機器上的檔案同步到一臺Windows機器的某個目錄下,由於本姑娘從來沒有碰到過這種問題,於是上網找了下資料發現了一個很好用的工具可以幫忙,那就是cwRsyncServer,好了,事不宜遲,開幹吧。

環境:一臺linux裝置;一臺windows裝置

軟體:cwRsyncServer服務端,Windows版

實現結構:Windows作為rsync服務端;linux作為rsync客戶端,linux本身也自帶rsync客戶端工具

部署過程:

1. 下載cwRsyncServer服務端工具,具體下載地址,各位看官可以自行網上搜索下載,本姑娘下載的版本是:cwRsyncServer_4.1.0_Installer

2. 解壓安裝該軟體:cwRsyncServer_4.1.0_Installer

wKioL1jcfDaRWAK4AAB2IYVrqIE197.jpg-wh_50

wKioL1jcfKHBw4u3AACfm_K8nAc614.png-wh_50

3. 安裝完成之後,開啟命令提示符,輸入:servervices.msc,啟動rsync服務

wKioL1jcfSuCnEjTAAChXKMmw6M513.png-wh_50

4. 修改配置rsync.conf檔案,如下:

uid=0

gid=0

use chroot = no

hosts allow = 10.123.108.202

log file = rsyncd.log


# Module definitions

# Remember cygwin naming conventions : c:\work becomes /cygwin/c/work 【注意這一句話的意思】

#

[T01]

path = /cygdrive/d/SparkAI/T01/

read only = false

transfer logging = yes

[T30]

path = /cygdrive/d/SparkAI/T30/

read only = false

transfer logging = yes


5.測試驗證:

rsync -avz --password-file=/root/rsyncd.secrets /home/xht/results_day_v1.0_t+1/predict_*.csv [email protected]::T01

rsync -avz --password-file=/root/rsyncd.secrets /home/xht/results_day_v1.0_t+30/predict_*.csv

[email protected]::T30

6. 又學會了一個新招 ,每天有點小收穫。

轉載於:https://blog.51cto.com/jianglipan/1911676