rsync安装使用

安装

yum install rsync

mkdir /etc/rsyncd

cd /etc/rsyncd

vi rsyncd.conf

 

pid file = /var/run/rsyncd.pid
uid = root
gid = root


use chroot = no  
read only = yes

#limit access to private LANs
hosts allow=192.168.1.2/32,127.0.0.1/32
hosts deny=*

max connections = 5
motd file = /etc/rsyncd/rsyncd.motd

#This will give you a separate log file
log file = /var/log/rsync.log

#This will log every file transferred - up to 85,000+ per user, per sync
transfer logging = yes

log format = %t %a %m %f %b
syslog facility = local3
timeout = 300

[ftp_home]
path = /ftp_data/ftp_dir
list=yes
ignore errors
auth users = ftpuser
#secrets file = /etc/rsyncd/rsyncd.secrets
comment = This is test data

  启动服务

/usr/bin/rsync --daemon  --config=/etc/rsyncd/rsyncd.conf

  关闭服务

kill `cat /var/run/rsyncd.pid` 

   

     查看服务

tail /var/log/rsync.log
ps aux|grep rsync
netstat -apn|grep 873

  加入开机启动

echo "/usr/bin/rsync --daemon  --config=/etc/rsyncd/rsyncd.conf" >> /etc/rc.local

  同步数据

rsync --list-only [email protected]::ftp_home

rsync -ave ssh [email protected]:/ftp_data/test1 .

  

你可能感兴趣的:(rsync安装使用)