winrsync同步Windows 資料到 Linux

來源:互聯網
上載者:User

標籤:rsync windows

目標

將Windows伺服器上某個目錄的資料完全同步到Linux伺服器。Windows作為服務端,開啟873連接埠,Linux 作為用戶端,從遠端向Windows 伺服器拉取資料。


Windows部署cwRsyncServer

1、下載cwRsyncServer4.1,進行安裝,在安裝時可以自訂使用者名稱密碼,但必須確保密碼的複雜度,否則系統無法成功建立使用者和服務。

650) this.width=650;" src="https://s4.51cto.com/wyfs02/M00/05/E3/wKiom1muEyDgVrleAADegCMgPpU905.jpg" title="444.jpg" alt="wKiom1muEyDgVrleAADegCMgPpU905.jpg" />


2、安裝完畢後,進入對應目錄配置conf檔案,預設的安裝路徑在C:\Program Files (x86)\ICW,修改此目錄下的rsyncd.conf檔案:

use chroot = falsestrict modes = falsehosts allow = *log file = rsyncd.logport = 873uid = 0        gid = 0# Module definitions# Remember cygwin naming conventions : c:\work becomes /cygwin/c/work#[rsyncdata]                     # 同步模組,可設定多個path = /cygdrive/d/rsyncdata    #此處表示D:/rsyncdata 目錄read only = falsetransfer logging = yeshosts allow = 192.168.1.231    #此處為Linux伺服器位址auth users = rsyncsecrets file = /cygdrive/d/rsyncd.secrets  #密碼檔案路勁

3、建立同步資料夾和密碼檔案:

  •  在D盤建立rsyncd.secrets檔案,確認尾碼名為secrets而不是txt,並添加帳號密碼內容:

     rsync:rsync

  • 建立或者選擇需要同步資料的檔案夾,並為檔案夾添加SvcCWRSYNC的使用者權限(full contronal)。

4、啟動服務:

在run命令框中輸入 services.msc ,進入服務管理介面,設定RsyncServer服務自啟動

650) this.width=650;" src="https://s4.51cto.com/wyfs02/M02/A4/97/wKioL1muPrOSrTIwAAHX_PG9GNc676.jpg" title="444.jpg" alt="wKioL1muPrOSrTIwAAHX_PG9GNc676.jpg" />

5、配置Windows防火牆,在入棧規則中添加允許訪問873連接埠。


Linux伺服器同步檔案

1、在Linux伺服器上安裝rsync:

 yum install rsync -y

2、配置密碼檔案:

echo "rsync" > /etc/rsyncd.secretschmod 600 /etc/rsyncd.secrets

3、建立/rsyncdata/data目錄使用如下命令同步檔案:

rsync -vazrtopqg --delete --password-file=/etc/rsyncd.secrets   [email protected]::rsyncdata /rsyncdata/data/

4、可將上面的命令添加到定時任務指令碼,每天淩晨2點執行一次:

0 2 * * * /bin/bash /scripts/rsyncbak/bak.sh &> /dev/null


本文出自 “Trying” 部落格,請務必保留此出處http://tryingstuff.blog.51cto.com/4603492/1962831

winrsync同步Windows 資料到 Linux

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.