当前位置 主页 > 服务器问题 > win服务器问题汇总 >

    windows下rsync的数据同步安装配置方法

    栏目:win服务器问题汇总 时间:2018-08-31 09:17

    windows下使用cwrsync同步数据的设置方法的参考资料,最后本站将会提供一个已测的方法,奉献给大家

    rsync的配置环境
    软件平台:windows2003
    软件版本:cwRsync_2.0.10_Installer cwRsync_Server_2.0.10_Installer
    硬件平台:dell2950 cpu1.6G*4 内存:4G 硬盘:1G*6 RAID5

    ===安装===

    在WINDOWS环境下安装rsync要安装服务端和客户端

    服务器端安装:运行cwRsync_Server_2.0.10_Installer
    客户端安装:运行cwRsync _2.0.10_Installe

    安装步骤和安装服务器端是一样的这里就不详细描述

    ===配置===
    配置和我们在linux下面的配置一样,在安装目录中找到rsync.conf文件进行配置:

    Rsync.conf文件:

    pid file = /var/run/rsyncd.pid

    lock file = /var/run/rsync.lock

    log file = /var/log/rsyncd.log

    uid = administrator

    gid = administrator

    use chroot = no

    max connections =4

    syslog facility = local5

    [test]

    path =/cygdrive/d/wlk

    comment=/cygdrive/d/wlk comment = BACKUP CLIENT IS SOLARIS 8 E250
    ignore errors # 可以忽略一些无关的IO错误
    read only = yes # 只读
    list = no # 不允许列文件
    auth users = inburst # 认证的用户名,如果没有这行,

    则表明是匿名
    secrets file = etc/inburst.pas # 认证文件名

    在server端生成一个密码文件etc/inburst.pas

    打开记事本

    inburst:hack

    保存在安装路径下面的etc文件加下面文件明保存为inburst.pas

    在服务中把RsyncServer启动,启动类型修改为自动
    这样服务器端就安装设置好了

    从client端进行测试
    下面这个命令行中-vzrtopg里的v是verbose,z是压缩,r是recursive,topg都是保持文件原有属性如属主、时间
    的参数。–progress是指显示

    出详细的进度情况,–delete是指如果服务器端删除了这一文件,那么客户端也相应把文件删除,保持真正的一致。
    后面的inburst@ip中,

    inburst是指定密码文件中的用户名,之后的::inburst这一inburst是模块名,也就是在/etc/rsyncd.conf中自定义
    的名称。最后的/tmp是备份
    到本地的目录名。
    在这里面,还可以用-e ssh的参数建立起加密的连接。可以用–password-file=/password/path/file来指定密码文
    件,这样就可以在脚本中使

    用而无需交互式地输入验证密码了,这里需要注意的是这份密码文件权限属性要设得只有属主可读。

    在客户端运行CMD

    rsync -av 10.0.0.16::401 /cygdrive/h/401


    复制代码 代码如下:
    @echo off
    rsync -ztruvoglp --progress --delete --password-file=wtjb51.pas /cygdrive/f/webroot/jb51/ wtjb51@221.192.1.1::dddown

    wtjb51.pas的内容
    复制代码 代码如下:jb51:www.iis7.com
    jb51是用户名,后面的是密码

    /cygdrive/f/webroot/jb51/中的f代表的是F盘,其它盘自行修改即可。

    rsync使用时的常见问题

    错误1: rsync: read error: Connection reset by peer (104)
    rsync error: error in rsync protocol data stream (code 12) at io.c(794) [receive r=3.0.2]
    解决:很大可能是服务器端没有开启 rsync 服务。开启服务。