<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


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

 

 


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

 

xnetid查找的配置文件位置默认是/etc下,根据具体情况创建软链接。例如:
ln -s /etc/rsyncd/rsyncd.conf /etc/rsyncd.conf

 

Windows 之间用rsync同步数据(cwRsyncServer配置)
常见错误:

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

相关文章:

  • 2021-12-03
  • 2022-01-04
  • 2021-07-16
  • 2021-12-25
  • 2021-10-29
  • 2021-07-27
猜你喜欢
  • 2021-07-07
  • 2022-12-23
  • 2021-12-10
  • 2021-09-27
  • 2022-02-08
相关资源
相似解决方案