Windows上cwRsync备份服务器数据

在两台Windows机器上使用cwRsync同步备份SVN服务器,cwRsync它是一个包含Cygwin和Rsync的软件包。
官网:http://www.itefix.no/cwrsync/

下载地址:http://sourceforge.net/projects/sereds/files/cwRsync/

目前最新为4.1.0:
cwRsyncServer_4.1.0_Installer.zip 是服务器端
cwRsync_4.1.0_Installer.zip 是客户端

一、安装


安装过程就是解压开来,基本一路next。

服务端:

安装server端默认有一个管理员账户SvcCWRSYNC,密码YoxSxnEA99k711,可自行修改。
启动rsync服务,进入“控制面板”—>“管理工具”—>“服务”,找到RsyncServer启动它。RsyncServer默认是手工方式启动,可以修改为自动。
启动完服务后可用netstat -a,查看有没有监听873端口。

客户端:

Secure Channel Wrapper & Wizard是安装安全隧道。传输加密。

二、配置


服务端:


修改配置文件rsyncd.conf:
默认内容如下
use chroot = false
strict modes = false
hosts allow = *
log file = rsyncd.log

# Module definitions
# Remember cygwin naming conventions : c:\work becomes /cygwin/c/work
#
[test]
path = /cygdrive/c/work
read only = false
transfer logging = yes

修改为
use chroot = false
strict modes = false
hosts allow = *
log file = rsyncd.log
pid file = rsyncd.pid
lock file = rsyncd.lock

uid = 0
gid = 0

#最大连接数10
max connections = 10

# Module definitions
# Remember cygwin naming conventions : c:\work becomes /cygwin/c/work
#
[test]
path = /cygdrive/c/work
read only = false
transfer logging = yes

#认证用户
auth users = rsyncuser

#表示路径为c:\Program Files\ICW\etc\rsyncd.secrets的验证文件
secrets file = etc/rsyncd.secrets

在服务里重启RsyncServer服务。

在c:\Program Files\ICW\etc\下建立用户验证文件rsyncd.secrets
文件内容为 用户名:密码
例如 rsyncuser:654321

在c盘下创建一个测试文件夹work,里面随便放点文件。

客户端:


在d盘建立一个密码文件,rsyncpass,输入授权用户的密码,例如 654321

打开一个cmd窗口,执行:
cd C:\Program Files\cwRsync\bin
rsync -vrtopg --progress --delete [email protected]::test --password-file=/cygdrive/d/rsyncpass /cygdrive/d/bak

-v, --verbose 详细模式输出。
-r, --recursive 对子目录以递归模式处理。
-topg 保持文件原有属性。
--progress指显示出详细的进度情况。
--delete指如果服务器端删除了这一文件,那么客户端也相应把文件删除,保持一致。
[email protected]::test表示,指定的用户@服务端IP::rsyncd.conf设置的那个模块。
/cygdrive/d/bak 表示客户端同步在d:\bak文件夹。

要同步SVN服务器可以在rsync.conf里新建一个模块。可以将同步备份命令加入计划任务定时执行。

参考资料:
http://blog.sina.com.cn/s/blog_6876fb5c0100m8ro.html
http://www.cbrother.com/html/2242.html
http://88263188.blog.51cto.com/416252/276193
http://bbs.linuxtone.org/thread-4067-1-1.html

你可能感兴趣的:(windows,File,服务器,logging,wrapper,wizard)