Windows下rsync軟體配置和使用

來源:互聯網
上載者:User
Windows下也有類似unix下的rsync軟體,最近我試用了cwRsync軟體,把配置和使用方法介紹一下,使用它確實比較方便。

        同步Rsync Server軟體下載 cwRsync_Server_2.0.10_Installer.zip 

        同步Rsync Client軟體下載 cwRsync_Client_2.0.10_Installer.zip
   
    在需要傳同步檔案出來的windows伺服器上安裝同步Rsync Server軟體cwRsync_Server_2.0.10_Installer後,
   
    會在伺服器上建一個管理員層級的SvcwRsync使用者,我們最好修改一下這個使用者的密碼。
   
    在此伺服器上還增加了一個RsyncServer服務,如果沒有設成自動啟動,需要設定一下,如下圖。   
   


   
    然後在安裝了同步Rsync Server和Rsync Client軟體的windows伺服器上設定環境變數:   
   


   
   把目錄C:/Program Files/cwRsyncServer/bin填加到目前使用者的path裡。
   
    同步Rsync Server上設定檔rsyncd.conf的一般格式類似:

###############################################################   

use chroot = false
strict modes = false
#hosts allow = 192.168.0.2
hosts allow = *
log file = rsyncd.log
pid file = rsyncd.pid
secrets file = password

# Module definitions
# Remember cygwin naming conventions : c:/work becomes /cygwin/c/work
#
[dbbackup]
path = /cygdrive/d/sqlserver_backup
read only = true
list = no
auth users = fengyu
transfer logging = yes

[test]
path = /cygdrive/d/ying
read only = true
list = no
auth users = ying
transfer logging = yes   
    
###############################################################   
    
  在Rsync Server的C:/Program Files/cwRsyncServer/目錄下密碼檔案password裡面內容如下:

fengyu:dbbackup_test
ying:maggie678

   這裡面的使用者名稱和密碼可以任意設定,跟windwos和unix帳號沒有任何關係。記住用冒號:分割使用者名稱和密碼

   在Rsync Client端寫一個包含rsync命令的批次程式rsync_test.bat
  
rsync -vzrtopg --progress --delete  --password-file=/cygdrive/f/fengyu/password2 fengyu@192.168.0.10::dbbackup /cygdrive/f/fengyu/dbbackup_test  

   請注意在Rsync Client端windows伺服器f:/fengyu/password2檔案裡只需要填寫密碼dbbackup_test,如下:
  
dbbackup_test  
  
   當然在unix機器上也可以用類似的方法擷取在Windows伺服器Rsync Server設定檔裡設定好的同步資料夾
  
   rsync -vzrtopg --progress --delete  --password-file=/home/ying/ying_passwd ying@192.168.0.10::test /home/ying/ying_test
  
   密碼/home/ying/ying_passwd檔案裡也只需要填maggie678,如下:
  
maggie678     

   如果想把同步操作定時完成,可以在Windows伺服器上設定 任務計劃,在unix機器上配置 cron作業。
  
   最後管理員定期查看Rsync Server上的同步處理記錄檔案C:/Program Files/cwRsyncServer/rsyncd.log
  
   就知道同步是否正常運行了。

相關文章

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在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.