linux rsync

服务端
创建配置 vi /etc/rsyncd.conf
uid = nobody
gid = nobody
use chroot = no
max connections = 4
pid file = /data/service/rsync/test/rsyncd.pid
lock file = /data/service/rsync/test/rsync.lock
log file = /data/service/rsync/test/rsyncd.log
#ignore errors
hosts allow = 10.10.10.10(允许连接的IP)
hosts deny = 0.0.0.0/0
list = true(允许客户端查看module)

#10.10.10.10
[backup]   (module名称)
path=/data/service/rsync/logs/     (备份路径)
read only = false  (可写)
auth users = root  (允许客户端连接的用户,多个可用",“分开)
secrets file = /etc/backserver.pas (密码文件,格式为user:pwd,权限为600)

启动rsync
rsync --daemon --password-file=/etc/rsyncd.conf

客户端
rsync rsync://10.10.10.10 查看可用的module
rsync -avzP /source rsync://10.10.10.10/backup --password-file=/etc/client.pas(只需要密码,权限为600)

可根据自己需要去定时执行

Local:  rsync [OPTION...] SRC... [DEST]

Access via remote shell:
  Pull: rsync [OPTION...] [USER@]HOST:SRC... [DEST]
  Push: rsync [OPTION...] SRC... [USER@]HOST:DEST

Access via rsync daemon:
  Pull: rsync [OPTION...] [USER@]HOST::SRC... [DEST]
        rsync [OPTION...] rsync://[USER@]HOST[:PORT]/SRC... [DEST]
  Push: rsync [OPTION...] SRC... [USER@]HOST::DEST
        rsync [OPTION...] SRC... rsync://[USER@]HOST[:PORT]/DEST

你可能感兴趣的:(linux,rsync)