当前位置:首页 > CN2资讯 > 正文内容

rsync windows 客户端 windows rsync服务器

2天前CN2资讯



Windows 之间用rsync同步数据(cwRsyncServer配置)

之间用rsync同步数据(cwRsyncServer配置)

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

一,下载
官方下载地址:官方网站:http://rsync.samba.org/download.html下载地址:

http://sourceforge.net/projects/sereds/files/cwRsync/4.1.0/

服务器版为:cwRsyncServer_4.1.0_Installer.rar

客户端为:cwRsync_4.1.0_Installer.rar

二、安装

服务器IP192.168.1.1

客户端IP:192.168.1.2

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

第二步:安装
安装如图:


点击“NEXT”,进入下一步;


选择“I Agree”


填入安装的目录。点击下一步


即可

第三步:配置
我们按照的路径是: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 [email protected]::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 "[email protected]::test" /cygdrive/g/test --password-file=/cygdrive/g/rsync/<g:\rsync\passwd.txt



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

正值巅峰!


常见错误:

错误一
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.




    你可能想看:

    扫描二维码推送至手机访问。

    版权声明:本文由皇冠云发布,如需转载请注明出处。

    本文链接:https://www.idchg.com/info/30428.html

    分享给朋友:

    “rsync windows 客户端 windows rsync服务器” 的相关文章

    mac ssh工具推荐:提升远程工作效率的最佳选择

    在现代计算机网络中,SSH(Secure Shell)是一个重要的工具。它为用户提供了一种安全的远程登录协议,广泛应用于网络管理、服务器配置等场景。我自己在处理多台服务器时,总是通过SSH来保证安全性和网络的高效性。通过SSH,我可以在远程计算机上执行命令和操作,感觉就像在本地电脑上一样。 在Mac...

    如何通过 NameCheap 注册 $0.99 便宜域名并选择合适后缀

    在如今的网络世界,获取一个合适的域名可以说是非常关键的。对我来说,域名不仅是一个网站的门牌,更是品牌的第一印象。最近,NameCheap 推出了一个令人兴奋的优惠活动,注册域名低至 $0.99 每年,这绝对是个让人心动的机会。想到能够以这样的低价拥有一个域名,真的是让我忍不住想赶紧注册。 相信大家对...

    inet.ws VPS测评:揭示高性价比主机服务的真实体验与分析

    在如今这个互联网发展的时代,选择一个可靠的虚拟专用服务器(VPS)提供商至关重要。我们要介绍的就是 inet.ws,一家国外的主机服务商。inet.ws 的主营业务是销售全球多节点的 VPS 服务器。自从 2023 年 8 月推出了全场 13 个机房的 7.5 折优惠活动后,它的性价比愈发吸引了许多...

    ExtraVM测评:美国优质VPS服务全面解析

    在美国,ExtraVM是一家备受关注的主机商,提供的VPS方案在业内小有名气。这家企业不仅因其强大的硬件配置而受到用户热爱,还因为具备高带宽和强大防御能力而赢得了良好的口碑。对于许多站长来说,这里就像是一块“宝地”,能够满足他们各种需求。 当我第一次了解ExtraVM的时候,我被其在洛杉矶的数据中心...

    全面解析UDP攻击:类型、影响及有效防御策略

    在当今网络环境中,UDP攻击是一个话题无法忽视的安全隐患。它是一种常见的网络攻击形式,通常会给目标服务器带来严重的资源消耗。为了更好地理解这一现象,我们不妨简单回顾一下UDP协议的特性,以及攻击者是如何利用这一协议实施攻击的。 UDP,即用户数据报协议(User Datagram Protocol)...

    选择最佳香港VPS大带宽服务的全面指南,助你无忧搭建在线业务

    在如今这个信息高速发展的时代,选择适合的VPS服务显得尤为重要。特别是香港VPS大带宽服务,以其独特的优势吸引了越来越多的用户。对于想要进行国际业务、网站托管或是搭建游戏服务器的用户来说,香港VPS大带宽服务绝对是个不错的选择。 香港VPS大带宽的优势显而易见。一个显著的特点是无需备案,这意味着用户...