在用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] 密码不对
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.