OS + Linux File nfs / samba / rsync / inotify / smb / webdav

s

OS + Linux File nfs / samba / rsync / inotify / smb / webdav

https://www.iteye.com/blog/user/lindows/blog/883586

RedHat Enterprise Linux 5.5 x64   Rsync  Service

rsync clinet端取数据时,出Connection reset by peer 的错误。

http://bbs.chinaunix.net/thread-2119601-1-1.html

rsync配置

http://rsync.samba.org

https://www.cnblogs.com/zhenhui/p/5715840.html

Server config 192.168.154.1:

[root@lindows ~]# more /etc/xinetd.d/rsync

Shell代码 
  1. # default: off  
  2. # description: The rsync server is a good addition to an ftp server, as it   
  3. #       allows crc checksumming etc.  
  4. service rsync  
  5. {  
  6.         disable = no  
  7.         socket_type     = stream  
  8.         wait            = no  
  9.         user            = root  
  10.         server          = /usr/bin/rsync  
  11.         server_args     = --daemon  
  12.         log_on_failure  += USERID  
  13. }  

开启rsync服务

[root@lindows ~]# chkconfig rsync on

编辑rsync配置

[root@lindows ~]# vim /etc/rsyncd .conf

Shell代码 
  1. ####***************************************####  
  2. [test]  
  3. pid file = /var/run/rsyncd.pid  
  4. log file = /var/log/rsyncd.log  
  5. path = /opt  
  6. uid=root  
  7. gid=root  
  8. max connections = 200  
  9. timeout = 600  
  10. use chroot = no  
  11. read only = yes  
  12. list = yes  
  13. ignore errors  
  14. #auth user = root  
  15. host_allow = *  
  16. syslog facility = local3  
  17. #rsync config  
  18. #The' standard' things  

启动rsync进程

[root@lindows ~]# /usr/bin/rsync --daemon --config=/etc/rsyncd.conf

[root@lindows ~]# ps -ef | grep rsyncd

root      6421     1  0 00:02 ?        00:00:00 /usr/bin/rsync --daemon --config=/etc/rsyncd.conf
root      7376  5082  0 00:29 pts/1    00:00:00 grep rsyncd
检查rsync端口

[root@localhost opt]# grep rsync /etc/services 
rsync           873/tcp                         # rsync
rsync           873/udp                         # rsync
airsync         2175/tcp                        # Microsoft Desktop AirSync Protocol
airsync         2175/udp                        # Microsoft Desktop AirSync Protocol

[root@localhost opt]# netstat -an | grep :873 
tcp        0      0 0.0.0.0:873                 0.0.0.0:*                   LISTEN      
tcp        0      0 :::873                      :::*                        LISTEN     

[root@localhost opt]# mkdir -p /opt/146soft

Clinet Rsync config 192.168.154.142:

查看rsync同步列表

[root@localhost opt]# rsync --list-only 192.168.154.146:/opt/ 

root@localhost opt]# rsync --list-only root@192.168.154.146:/opt/ 
drwxr-xr-x        4096 2011/05/26 23:44:12 .
drwxr-xr-x        4096 2011/05/26 23:35:55 54.146_soft
测试rsync同步全部数据 ok

[root@localhost opt]# rsync -auqz 192.168.154.146::test /opt/

测试rsync同步增量数据 ok

[root@localhost opt]#/usr/bin/rsync -avuztorpg --delete --progress 192.168.154.146::test ./ >> /opt/rsync_log/rsync_$HOSTNAME.log

[root@localhost opt]#/usr/bin/rsync -avuztorpg --delete --progress root@192.168.154.146::test ./ >> /opt/rsync_log/rsync_$HOSTNAME.log

http://www.ryong21.com/archives/576.html

rsync error: timeout in data send/receive 
    如果同步的文件很多,rsync客户端会出现这样的错误:

        rsync error: timeout in data send/receive (code 30) at io.c(171) [sender=2.6.8]
        rsync: connection unexpectedly closed 

    在rsync命令中加上–timeout=TIME  设置 I/O 超时时间就可以了。TIME单位是秒。

rsync的各种返回值的含义: 
http://www.codelast.com/?p=796
0    Success
1    Syntax or usage error
2    Protocol incompatibility
3    Errors selecting input/output files, dirs
4    Requested action not supported: an attempt was made to manipulate 64-bit files on a platform that cannot support them; or an option was specified that is supported by the client and not by the server.
5    Error starting client-server protocol
10    Error in socket I/O
11    Error in file I/O
12    Error in rsync protocol data stream
13    Errors with program diagnostics
14    Error in IPC code
20    Received SIGUSR1 or SIGINT
21    Some error returned by waitpid()
22    Error allocating core memory buffers
23    Partial transfer due to error
24    Partial transfer due to vanished source files
30    Timeout in data send/receive

end

 http://rsync.samba.org

原文地址:https://www.cnblogs.com/lindows/p/13986266.html