- 论坛徽章:
- 0
|
cwrsync??windows下的rsync
web 站点的数据备份 rsync 官方站点
http://rsync.samba.org/
http://samba.anu.edu.au/rsync/download.html
[ WINDOWS 2003 RSYNC 服务端 ]
rsync for windows download :
附件二:
1. 安装
选择安装路径 D:\cwRsyncServer , 注: rsync 是作为cgywin的一个包装到windows下的
安装时 Rsync 会做下面的工作
a. 新建一个用户SvcwRsync 并且这个用户是管理员用户
b. 设置好安装目录的权限 D:\cwRsyncServer , 请不要自行更改权限
c. 创建服务RsyncServer
低版本中可能需要手工做上面的步骤 , 并需要象下面一样手工创建服务 , 但是这里3个步骤安装程序都已经做好了
cygrunsrv.exe -I "Rsync" -p /cygdrive/d/cwRsyncServer/bin/rsync.exe -a "--config=/cygdrive/d/cwRsyncServer/etc/rsyncd.conf --daemon --no-detach"
-f "Rsync" -u Administrator -w 123456
2. 修改rsync服务的配置文件 .- 01.#################
-
- 02.#rsyncd.conf
-
- 03.#################
-
- 04.
-
- 05.use chroot = false
-
- 06.strict modes = false
-
- 07.hosts allow = *
-
- 08.log file = rsyncd.log
-
- 09.pid file = rsyncd.pid
-
- 10.max connections = 4 # 最大连接数为4
-
- 11.
-
- 12.# Module definitions
-
- 13.# Remember cygwin naming conventions : c:\work becomes /cygwin/c/work
-
- 14.#
-
- 15.[test]
-
- 16.path = /cygdrive/d/cwRsyncServer/var/backup
-
- 17.read only = false
-
- 18.ignore errors
-
- 19.auth users = test_user
-
- 20.secrets file= /cygdrive/d/cwRsyncServer/etc/rsync.pass
-
- 21.transfer logging = yes
-
- 22.
-
- 23.[a.b]
-
- 24.path = /cygdrive/d/cwRsyncServer/var/backup/51.201
-
- 25.read only = false
-
- 26.ignore errors
-
- 27.auth users = a.b
-
- 28.hosts allow=61.129.a.b
-
- 29.secrets file= /cygdrive/d/cwRsyncServer/etc/rsync.pass
-
- 30.transfer logging = yes
-
- 31.
-
- 32.###
-
- 33.# rsync.pass 文件内容 :
-
- 34.###
-
- 35.test_user:123456
-
- 36.a.b:abc
- 复制代码
复制代码 3. 创建备份目录 如 /var/backup 相当与 D:\cwRsyncServer\var\backup 也就是 /cygdrive/d/cwRsyncServer/var/backup
4. 确定administrator对 D:\cwRsyncServer 目录有完全控制的权限 包括子目录 (可以略去 前面安装的时候安装程序已经自动设定了)
5. 在服务里面启动 RsyncServer 服务正常的话可以看到873端口在listening
参考
http://www.stcore.com/html/2006/0216/112591.html
http://bbs.chinaunix.net/viewthr ... p;extra=&page=1
rsync 客户端使用 如
rsync -vrtz conf [email=a.b@61.129.70.*::a.b]a.b@61.129.70.*::a.b[/email] # 上传
rsync -vrtz [email=a.b@61.129.70.*::a.b]a.b@61.129.70.*::a.b[/email] bak # 下载
rsync -vrtz [email=a.b@61.129.70.*::a.b/conf/apache_configuration]a.b@61.129.70.*::a.b/conf/apache_configuration[/email] bak # 下载一部分
一、windows与windows同步
1.准备两台机器:
server-----192.168.0.201
client-----192.168.0.202
2.下载windows版的rsync工具
具体软件下载链接我也忘了,不过在google应该可以搜索到。
附件可以下载
server端:cwRsync_Server_2.0.10_Installer.zip
client端:cwRsync_2.0.10_Installer.zip
3.安装 与配置
SERVER:
(1)安装cwRsync_Server_2.0.10_Installer.zip
在开始程序中打开“start a unix bash shell”程序:
进入一个类似cmd的终端,输入如下命令:
$/bin/activate-user.sh
输入l
输入administrator
后面全按回来结束
(2)启动opensshd
打开“控制面板”-->“管理工具”-->“服务”:
找到一个opensshd的服务,启动它
(3)配置rsyncd.conf配置文件
编辑C:\Program Files\cwRsyncServer\rsyncd.conf,内容如下:
use chroot = false
strict modes = false
hosts allow = *
log file = rsyncd.log
pid file = rsyncd.pid
# Module definitions
# Remember cygwin naming conventions : c:\work becomes /cygwin/c/work
[rsync]
path = /cygdrive/f/rsync (此处路径代表f:\rsync目录)
read only = yes
transfer logging = yes
secrets file = /cygdrive/f/rsyncd.secrets
(4)启动rsync服务
打开“控制面板”-->“管理工具”-->“服务”:
找到一个RsyncServer的服务,启动它
到此server端配置结束,接下来配置client端 。
CLIENT:
(1)安装client端软件包:cwRsync_2.0.10_Installer.zip
(2)打开cmd,执行如下操作,测试服务端是否正常 启动服务 了:
cd C:\Program Files\cwRsync\bin
telnet 192.168.0.201 22
telnet 192.168.0.201 873
若上述测试成功,此时可执行同步计划:
rsync -vzrtopg --progress --delete 192.168.0.201::rsync /cygdrive/d/test
或者是:
rsync -vzrtopg --progress --delete 192.168.0.201:/cygdrive/d/rsync /cygdrive/d/test
(此时,会提示输入密码,用户名为administrator,密码则为192.168.0.201的管理员登录密码)
至此,安装配置windows到windows间的同步已经OK
如果定时同步server上的文件,可将其加入任务计划中。
二、windows作为server时与linux间的同步
1、准备机器,此时使用windows作为server
server---192.168.0.201 (windows)
client---192.168.0.132 (linux)
2、经过上文的操作,此时可简化操作了
进入linux主机client同步server:
#rsync -vzrtopg --progress --delete 192.168.0.201::rsync /test
三、linux作为server时与windows间的同步
1、准备机器,此时使用linux作为server
server---192.168.0.132 (linux)
client---192.168.0.202 (windows)
2、安装与配置linux主机的rsync
(1)查看linux上是否安装rsync:
#rpm -qa|grep rsync
若无则安装,或者使用tar编译安装
#rpm -ivh rsync-2.6.8-3.1.rpm
(2)打开rsync服务
#chkconfig xinetd on
#chkconfig rsync on
(3)创建 rsyncd.conf 文件
#touch /etc/rsyncd.conf
#vi /etc/rsyncd.conf(内容如下:)
uid = nobody
gid = nobody
max connections = 4
[www]
path = /www
comment = BACKUP WWW
ignore errors
read only = yes
list = no
auth users = wwwuser
hosts allow=192.168.0.202
secrets file = /etc/wwwuser.pass
(4)启动基于xinetd进程的rsync服务
#/etc/init.d/xinetd start
3、配置windows的rsync客户端
(1)安装client端的rsync包
(2)打开cmd,执行同步计划:
cd C:\Program Files\cwRsync\bin
rsync -vzrtopg --progress --delete root@192.168.0.132::www /cygdrive/d/test
(此时须输入root用户的密码,就可进行同步了。)
至此,全部配置完成。
注:
要使用加密的同步,可使用……
rsync -e 'ssh -p 2002' -vzrtopg --progress --delete root@192.168.0.132::www /cygdrive/d/test |
|