rsync详细配置过程

Rsync配置:

服务端配置:

root@ubuntu:~# more /etc/rsyncd/rsyncd.conf

uid=nobody
gid=nobody
max connections=4
timeout=600
use chroot=no
read only=yes
pid file=/var/run/rsyncd.pid
lock file=/var/run/rsyncd.lock
log file=/var/log/rsyncd.log
host_allow=*
#syslog facility=local7
#log file=/var/log/rsyncd.log
#rsync config
#The 'standard' things

[ redis_backup_dir]
uid=0
gid=0
path=/data/redis
comment=This is a redis backup role
#ignore errors
read only=yes
list=no
auth users=redis_backup
secrets file=/etc/rsyncd/rsync_backserver.pas

root@ubuntu:~# vi /etc/rsyncd/rsync_backserver.pas
test:1234567
root@ubuntu:/etc/rsyncd# sudo chmod 600 /etc/rsyncd/rsync_backserver.pas

root@ubuntu:~# sudo rsync --daemon --config=/etc/rsyncd/rsyncd.conf
failed to create pid file /var/run/rsyncd.pid: File exists
root@ubuntu:~# sudo rm -f /var/run/rsyncd.pid
root@ubuntu:~# sudo rsync --daemon --config=/etc/rsyncd/rsyncd.conf

root@ubuntu:/etc/rsyncd# more /var/log/rsyncd.log
2014/01/02 11:33:26 [29589] Unknown Parameter encountered: "host_allow"
2014/01/02 11:33:26 [29589] IGNORING unknown parameter "host_allow"
2014/01/02 11:33:26 [29590] rsyncd version 3.0.9 starting, listening on port 873


到此为止,服务端即配置完毕。


客户端:

root@AY130925102139735305Z:/usr/local/programs/backup_redis_sh# sudo vi ./rsyncd_redis.pas
1234567
root@AY130925102139735305Z:/usr/local/programs/backup_redis_sh# sudo chmod 600 ./rsyncd_redis.pas

root@AY130925102139735305Z:/usr/local/programs/backup_redis_sh# rsync -vzrtopg --progress --delete test@192.168.1.123::redis_backup_dir/*.txt /data/_redis_16_backup/ --password-file=/usr/local/programs/backup_redis_sh/rsyncd_redis.pas
receiving incremental file list
1.txt
          23 100%   22.46kB/s    0:00:00 (xfer#1, to-check=0/1)

sent 93 bytes  received 161 bytes  508.00 bytes/sec
total size is 23  speedup is 0.09


你可能感兴趣的:(rsync)