Windows 之间用rsync同步数据(cwRsyncServer配置) html 前提:在服务端要安装COpssh.(opend ssh 服务) rsync是一款优秀的数据同步软件,在跨服务器,跨机房,跨国备份服务器的首选工具,下面就来介绍下如何配置安装cwRsyncServer很大多数软件同样是B/C架构,cwRsyncServer是rsync的windows版本 一,下载 官方下载地址:官方网站:http://rsync.samba.org/download.html 下载地址: mysql http://sourceforge.net/projects/sereds/files/cwRsync/4.1.0/ sql 服务器版为:cwRsyncServer_4.1.0_Installer.rar windows 客户端为:cwRsync_4.1.0_Installer.rar 服务器 2、安装 架构 服务器IP192.168.1.1 ssh 客户端IP:192.168.1.2 异步 1,服务器安装 第一步:创建cwRsyncServer运行帐户,这一步是必须的,不然你安装完连启动都启动不来哦 用户名:test 密码:test 而且加入管理员组! 注意:这个账号只是安装和运行用的帐户,别无它用 socket 第二步:安装 安装如图:  点击“NEXT”,进入下一步;  选择“I Agree” 填入安装的目录。点击下一步 按照完毕后点击closed便可 第三步:配置 咱们按照的路径是:E:\Program Files\ICW\ 那咱们就进入到这个目录 打开rsyncd.conf编辑内容以下: use chroot = false uid = 0 gid = 0 strict modes = false log file = rsyncd.log port = 10556 [www] path = /cygdrive/c/www read only = false transfer logging = yes auth users = testuser secrets file = etc/testuser.pas hosts allow = 192.168.1.2 hosts deny = 0.0.0.0/0 [mysql] path = /cygdrive/d/MySQL/MySQL Server 5.0/data/bbs auth users = testuser secrets file = etc/testuser.pas hosts allow = 192.168.1.2 hosts deny = 0.0.0.0/0 而后进入E:\Program Files\ICW\etc目录创建testuser.pas文本文件,注意文件全名为testuser.pas 输入: testuser:123 即:用户名为:testuser 密码为:123 这个用户才是客户端链接服务器是要认证的用户名和密码 rsync的默认端口是873 第四步:启动服务 运行---cmd---services.msc。找到RsyncServer服务,启动。 本地测试一下:telnet 127.0.0.1 10556 防火墙记得开启这个端口 2,客户端安装 解压:cwRsync_4.1.0_Installer.zip按照向导安装 按照完成后: cd C:\Program Files\cwRsync\bin> 启动客户端链接服务器 rsync.exe -vzrtopg --progress --delete wodetop@1 92.168.1.1::www /cygdrive/e/databackup/www --port=10556 输入密码 3,设置计划任务,定时同步数据: 注意,计划任务这块要提示输入密码,下面是不用输入密码的脚本 @echo off "c:\Program Files\cwRsync\bin\rsync.exe" -vzrtopg --progress --delete cnuser@192.168.1.1::www /cygdrive/e/databackup/www --port=10556 --password-file=/cygdrive/e/databackup/rsyncpwd.txt < E:\databackup\passwd.txt 复制代码 在E:\databackup目录下创建一个空文件名:rsyncpwd.txt 再创建个E:\databackup\passwd.txt 输入密码 否这回出现下面错误:password file must not be other-accessible password file must be owned by root when running as root 楼下会给出常见的一些问题 |