免费注册 查看新帖 |

Chinaunix

  平台 论坛 博客 文库
最近访问板块 发新帖
查看: 2148 | 回复: 3
打印 上一主题 下一主题

cwrsync??windows下的rsync [复制链接]

论坛徽章:
0
跳转到指定楼层
1 [收藏(0)] [报告]
发表于 2011-12-14 21:16 |只看该作者 |倒序浏览
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服务的配置文件 .
  1. 01.#################

  2. 02.#rsyncd.conf

  3. 03.#################

  4. 04.

  5. 05.use chroot = false

  6. 06.strict modes = false

  7. 07.hosts allow = *

  8. 08.log file = rsyncd.log

  9. 09.pid file = rsyncd.pid

  10. 10.max connections = 4               # 最大连接数为4

  11. 11.

  12. 12.# Module definitions

  13. 13.# Remember cygwin naming conventions : c:\work becomes /cygwin/c/work

  14. 14.#

  15. 15.[test]

  16. 16.path = /cygdrive/d/cwRsyncServer/var/backup

  17. 17.read only = false

  18. 18.ignore errors

  19. 19.auth users = test_user

  20. 20.secrets file= /cygdrive/d/cwRsyncServer/etc/rsync.pass

  21. 21.transfer logging = yes

  22. 22.

  23. 23.[a.b]

  24. 24.path = /cygdrive/d/cwRsyncServer/var/backup/51.201

  25. 25.read only = false

  26. 26.ignore errors

  27. 27.auth users = a.b

  28. 28.hosts allow=61.129.a.b

  29. 29.secrets file= /cygdrive/d/cwRsyncServer/etc/rsync.pass

  30. 30.transfer logging = yes

  31. 31.

  32. 32.###

  33. 33.# rsync.pass 文件内容 :

  34. 34.###

  35. 35.test_user:123456

  36. 36.a.b:abc
  37. 复制代码
复制代码
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

论坛徽章:
0
2 [报告]
发表于 2011-12-20 14:28 |只看该作者
希望于楼主多多交流哦

论坛徽章:
0
3 [报告]
发表于 2011-12-20 15:20 |只看该作者
一直在用, 说个心得; 配置文件要 ANSI ASCII 编码, 被这个害惨了

论坛徽章:
0
4 [报告]
发表于 2011-12-20 17:59 |只看该作者
本帖最后由 king_819 于 2011-12-20 18:00 编辑

windows下比较好的同步解决方案了
您需要登录后才可以回帖 登录 | 注册

本版积分规则 发表回复

  

北京盛拓优讯信息技术有限公司. 版权所有 京ICP备16024965号-6 北京市公安局海淀分局网监中心备案编号:11010802020122 niuxiaotong@pcpop.com 17352615567
未成年举报专区
中国互联网协会会员  联系我们:huangweiwei@itpub.net
感谢所有关心和支持过ChinaUnix的朋友们 转载本站内容请注明原作者名及出处

清除 Cookies - ChinaUnix - Archiver - WAP - TOP