linux rsync使用总结

一. 在本机上直接运作,用法就与 cp 几乎一模一样,例如:
  rsync -av /etc /tmp (将 /etc/ 的数据备份到 /tmp/etc 内)

二. 透过 rsh 或 ssh 的信道在 server / client 之间进行数据传输,例如:
  rsync -av -e ssh user@rsh.server:/etc /tmp (将 rsh.server 的 /etc 备份到本地主机的 /tmp 内)
三. 直接透过 rsync 提供的服务 (daemon) 来传输,此时 rsync 主机需要启动 873 port:

  1. 你必须要在 server 端启动 rsync服务,启动方法在以下链接的super deamon启动方法里:https://www.cnblogs.com/wangzengyi/p/12451828.html

  2. 配置文件修改

    • pid file = /var/run/rsyncd.pid
      port = 873
      address = [本端服务器IP地址]
      uid = nobody
      gid = nobody
      
      use chroot = yes
      read only = yes
      
      #limit access to private LANs
      #hosts allow=192.168.31.0/24
      #hosts deny=*
      
      log file = /var/log/rsync.log
      
      log format = %t %a %m %f %b
      syslog facility = local3
      timeout = 300
      
      
      [pdns_host]
          path = /etc/pdns-recursor/
          uid = 0
          gid = 0
          read only = yes
          list = no
          hosts allow = 192.168.31.0/24 192.168.10.0/24
      vim /etc/rsyncd.conf  

  3. 使用方法

    • rsync -av [服务器IP]::[远端目录路径和文件] [本地路径]

       

        
posted @ 2020-03-14 11:29  IamJet  阅读(227)  评论(0编辑  收藏  举报