如果實現網站同步

作者:YOUDI(Kevin.U)

安裝:

Wget http://samba.anu.edu.au/ftp/rsync/rsync-3.0.3.tar.gz

tar zxvf rsync-<?XML:NAMESPACE PREFIX = ST1 />3.0.3.tar.gz

cd rsync-3.0.3

./configure

make

make install

設置:

vim rc.local

加入

/usr/bin/rsync --daemon --config=/etc/rsyncd.conf

vi /etc/rsyncd.conf

uid = root

gid = root

max connections = 4

port = 888

hosts allow = 允許主機列表,ip,ip

#hosts deny = 0.0.0.0/32

[項目名稱]

path=項目路徑

comment = 備註

read only = yes

auth users = sms,test 允許客戶端哪些用戶執行

strict modes = false

secrets file = /etc/rsyncd.secrets 認證文件.

rsyncd.secrets

//客戶端認證文件

sms:xxxxxxxxxxxxxxxx

test:xxxxxxxxxxxxxxxxx

用戶名:密碼

客戶端執行同步:

rsync --port=888 -vzrtp --progress --delete --password-file=/www/scripts/rsync.passwd [email protected]::cuc /www/cuc/

rsync –port=端口

vverbosez是壓縮,rrecursivetopg都是保持文件原有屬性如屬主、時間的參數。--progress是指顯示出詳細的進度情況,--delete是指如果服務器端刪除了這一文件,那麼客戶端也相應把文件刪除,保持真正的一致

用戶@主機名::模塊名 路徑

rsync.passwd

rsyncd.secrets 客戶端認證文件

中的密碼

: xxxxxxxxxxxxxxxxx

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章