如果实现网站同步

作者: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

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