rsync是一款优秀的数据同步软件,在跨服务器,跨机房,跨国备份服务器的首选工具,下面就来介绍下如何配置安装cwRsyncServer很大多数软件一样是B/C架构,cwRsyncServer是rsync的windows版本

一,下载
官方下载地址:官方网站:http://rsync.samba.org/download.html
下载地址:
http://sourceforge.net/projects/sereds/files/cwRsync/4.1.0/

服务器版为: <ignore_js_op> cwRsyncServer_4.1.0_Installer.rar (3.65 MB, 下载次数: 91) 
客户端版为: <ignore_js_op> cwRsync_4.1.0_Installer.rar (3.4 MB, 下载次数: 153)

二,安装

服务器IP:192.168.1.1
客户端IP:192.168.1.2

1,服务器安装

第一步:建立cwRsyncServer运行账户,这一步是必须的,否则你安装完连启动都启动不来哦
用户名:test
密码:test
并且加入管理员组!
注意:这个帐号只是安装和运行用的账户,别无它用

第二步:安装
安装如图:

<ignore_js_op>

<ignore_js_op>

<ignore_js_op>

输入刚刚建立的帐号

<ignore_js_op>

按照完毕后点击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
这个用户才是客户端连接服务器是要认证的用户名和密码

第四步:启动服务
运行---cmd---services.msc
如图启动服务:

<ignore_js_op>

本地测试一下: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@192.168.1.1::www /cygdrive/e/databackup/www --port=10556
输入密码

3,设置计划任务,定时同步数据:

注意,计划任务这块要提示输入密码,下面是不用输入密码的脚本

  1. @echo off
  2. "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

楼下会给出常见的一些问题

安装完 cwRsync客户端后,开始写bat 执行文件,遇到的第一件事情就是就同步到本地时 目录不认识,报错如下:

The source and destination cannot both be remote.
rsync error: syntax or usage error (code 1) at main.c(1138) [Receiver=3.0.7]

主要原因是cwRsync 不能直接认识本地盘,必须加上 /cygdrive/g/test

意思为g:\test目录

客户端密码文件报错如下:

rsync password file must be owned by root when running as root

万能的GOOGLE告诉我,可以用一个变通的方式解决就是

@echo off
"C:\Program Files (x86)\cwRsync\bin\rsync" -rlptDzv --progress --delete "backup@192.88.88.128::test" /cygdrive/g/test --password-file=/cygdrive/g/rsync/passws.ps<g:\rsync\passwd.txt

在g:\rsync 下建立了一个文件,写入密码,然后同步密码最后在这个文件中输入即可。如上所例。

rsync问题小结

在用rsync同步数据的时候,经常会出现一些问题,我将遇到的总结如下:
1、权限问题
类似如下的提示:rsync: opendir "/kexue" (in dtsChannel) failed: Permission denied (13)注意查看同步的目录权限是否为755
2、time out
rsync: failed to connect to 203.100.192.66: Connection timed out (110)
rsync error: error in socket IO (code 10) at clientserver.c(124) [receiver=3.0.5]
检查服务器的端口netstat –tunlp,远程telnet测试。
3、服务未启动
rsync: failed to connect to 10.10.10.170: Connection refused (111)
rsync error: error in socket IO (code 10) at clientserver.c(124) [receiver=3.0.5]
启动服务:rsync --daemon --config=/etc/rsyncd.conf
4、磁盘空间满
rsync: recv_generator: mkdir "/teacherclubBackup/rsync……" failed: No space left on device (28)
*** Skipping any contents from this failed directory ***
5、Ctrl+C或者大量文件
rsync error: received SIGINT, SIGTERM, or SIGHUP (code 20) at rsync.c(544) [receiver=3.0.5]
rsync error: received SIGINT, SIGTERM, or SIGHUP (code 20) at rsync.c(544) [generator=3.0.5]
6、xnetid启动
rsync: read error: Connection reset by peer (104)
rsync error: error in rsync protocol data stream (code 12) at io.c(759) [receiver=3.0.5]
查看rsync日志
rsync: unable to open configuration file "/etc/rsyncd.conf": No such file or directory
xnetid查找的配置文件位置默认是/etc下,根据具体情况创建软链接。例如:
ln -s /etc/rsyncd/rsyncd.conf /etc/rsyncd.conf

常见错误:

错误一
rsync: failed to connect to 96.44.169.178 (*inet_ntop failed*): Connection timed
out (116)
      1 [main] rsync 3468 exception::handle: Exception: STATUS_ACCESS_VIOLATION
    740 [main] rsync 3468 open_stackdumpfile: Dumping stack trace to rsync.exe.s
tackdump
1,防火墙问题
2,端口不对

错误二
@ERROR: auth failed on module www
rsync error: error starting client-server protocol (code 5) at main.c(1516) [Rec
eiver=3.0.8]
密码不对

错误三
@ERROR: invalid uid nobody
rsync error: error starting client-server protocol (code 5) at main.c(1516) [Rec
eiver=3.0.8]
UID不对,默认是nobody
解决方法:
uid = 0
gid = 0

错误四
receiving incremental file list
rsync: read error: Connection reset by peer (104)
rsync error: error in rsync protocol data stream (code 12) at io.c(769) [receive
r=3.0.8]
rsync: connection unexpectedly closed (60 bytes received so far) [generator]
rsync error: error in rsync protocol data stream (code 12) at io.c(610) [generat
or=3.0.8]
可能原因:
1,磁盘挂载是用异步的(async)
然后,检查了/etc/fstab ,去掉async参数。

2,我在服务器上查看日志,看到有这么一行:
rsync: unable to open configuration file "/etc/rsyncd.conf": No such file or directory

于是我:
ln -s /etc/rsyncd/rsyncd.conf /etc/rsyncd.conf

3,同步文件数较多的目录出错
有个子目录中文件较多,也就8000来个吧,总是同步一半便退出。在批处理中加上-v参数,看到错误信息如下:
rsync: writefd_unbuffered failed to write 4 bytes to socket [sender]: Connection reset by peer (104)
rsync: read error: Connection reset by peer (104)
rsync error: error in rsync protocol data stream (code 12) at io.c(768) [sender=
3.0.6]

这个问题有点头疼,在www.itefix.no网站论坛上也没能查出个所以然。

不过最终还是在samba.org上找到解决方案:

在客户端命令行中加上--no-iconv参数就可以了。

原以为是文件太多,缓冲区不够引起,但看这个解决方案,似乎是转换编码方面的bug了。

在rsync的文档中描述如下:
http://rsync.samba.org/ftp/rsync/rsync.html
--iconv=CONVERT_SPEC
Rsync can convert filenames between character sets using this option. Using a CONVERT_SPEC of "." tells rsync to look up the default character-set via the locale setting. Alternately, you can fully specify what conversion to do by giving a local and a remote charset separated by a comma in the order --iconv=LOCAL,REMOTE, e.g. --iconv=utf8,iso88591. This order ensures that the option will stay the same whether you're pushing or pulling files. Finally, you can specify either --no-iconv or a CONVERT_SPEC of "-" to turn off any conversion. The default setting of this option is site-specific, and can also be affected via the RSYNC_ICONV environment variable.

Windows 之间用rsync同步数据(cwRsyncServer配置)的更多相关文章

  1. Linux运维: Rsync同步数据(ubuntu16.04+windows10)

    rsync同步数据 -环境:Linux (ubuntu16.04) + windows10 Linux: 安装 sudo apt-get install rsync rsync --version 查 ...

  2. 本文讲述下windows下使用rsync备份数据

    本文讲述下windows下使用rsync备份数据 需要使用的软件如下: 环境需求: 上海monitor上跑有定时任务计划备份线上数据库,现在需要把上海monitor上的备份数据拉回到179.12数据回 ...

  3. rsync在windows和linux同步数据的配置过程

    centos7.0安装rsync3.0.9-17.el7 yum install rsync ===================================================== ...

  4. 配置rsync 同步数据 rpm包安装rsync及配置

    [root@Hammer home]# rpm -qa |grep rsync #检查系统是否安装了rsync软件包rsync-2.6.8-3.1[root@Hammer CentOS]# rpm - ...

  5. Ubuntu下多服务器 Rsync同步镜像服务配置

    主服务器:192.168.5.13_ubuntu 从服务器:192.168.5.11_centos ================== 1> 在两台主机上分别安装rsync========== ...

  6. rsync同步工具的配置与使用

    一.什么是rsync?rsync是一款开源的,快速的,多功能的,可实现全量及增量的本地或远程数据同步备份的优秀工具. rsync官网 http://rsync.samba.org/ 二.rsync的工 ...

  7. windows 下的 Rsync 同步

    整理一下 windows 下的 rsync 文件同步. Rsync下载地址: 链接:https://pan.baidu.com/s/1nL0Ee_u76ytWKUFMeiKDIw 提取码:52in 一 ...

  8. 使用rsync 同步数据一些常用参数和示例

    rsync rsync是linux系统下的数据镜像备份工具.支持远程同步,本地复制,或者与其他SSH.rsync主机同步. 包括本地推到远程,远程拉到本地两种同步方式,也可以实现本地不同路径下文件的同 ...

  9. 实现Rsync同步Nginx前端配置

    近期,由于我们的阿里前端服务器频频受到恶意的流量攻击,导致前端NGINX进入黑洞而无法正常访问公司网站. 按之前的预计方法,采用加速乐及备用全配置前端的作法,将恶意短时流量攻击的损失时间降到最短.现将 ...

随机推荐

  1. SQL Server是如何让定时作业

    如果在SQL Server 里需要定时或者每隔一段时间执行某个存储过程或3200字符以内的SQL语句时,可以用管理->SQL Server代理->作业来实现. 1.管理->SQL S ...

  2. ACM俱乐部 字符串

    数制转换分数: 2 时间限制:1 秒 内存限制:32 兆 特殊判题: 否 提交:59 解决: 24 标签 进制转换 题目描述 求任意两个不同进制非负整数的转换(2进制-16进制),所给整数在long所 ...

  3. Node.js的process模块

    process模块用来与当前进程互动,可以通过全局变量process访问,不必使用require命令加载.它是一个EventEmitter对象的实例. 属性 process对象提供一系列属性,用于返回 ...

  4. 2、[转]WPF与WinForm的比较

    http://www.cnblogs.com/KnightsWarrior/archive/2010/07/09/1774059.htmlhttp://www.cnblogs.com/zenghong ...

  5. 视网膜New iPad与普通分辨率iPad页面的兼容处理

    一.这是篇经验分享 就算不是果粉也应该知道,iPad2与new iPad的重大区别之一就是显示屏的分辨率.new iPad显示屏被称之为“视网膜显示屏”,其设备分辨比(之前有详细介绍,点击这里查看)是 ...

  6. Many To one 多对一

    一.创建实体类:多方存一方的对象.set/get 二.编写对象的xml文件 别忘记在confg.xml映射! 三.编写接口 四.方法测试

  7. 1040: [ZJOI2008]骑士 - BZOJ

    Description Z国的骑士团是一个很有势力的组织,帮会中汇聚了来自各地的精英.他们劫富济贫,惩恶扬善,受到社会各界的赞扬.最近发生了一件可怕的事情,邪恶的Y国发动了一场针对Z国的侵略战争.战火 ...

  8. NOIP2014 行记

    不知道OI是啥或者信息学竞赛是啥的可以按`Ctrl+W`. <del>很早开始写的..准备出分之后再发布.</del> 谨以此文纪念我信息学竞赛的第一次正式考试. 背景音乐底部 ...

  9. [转载]深入理解ASP.NET MVC之ActionResult

    Action全局观 在上一篇最后,我们进行到了Action调用的“门口”: 1 if (!ActionInvoker.InvokeAction(ControllerContext, actionNam ...

  10. 关于ref与out的区别

    写在最前面 这几天一直在公司接受培训,都是一些基础的知识,同时也乘着这个机会巩固一下自己的基础,基础太重要了.前些时一直看的是多线程方面的知识,接下来我会写一些其他方面的知识,毕竟作为一个实习新人得和 ...