大家可以邮件交流哈
分类: LINUX
2012-03-29 15:41:16
先安装rsync
然后find / -name "rsync" 找到安装的文件
创建rsync的相关配置文件
mkdir /etc/rsync
vi rsync.conf
# Minimal configuration file for rsync daemon
# See rsync(1) and rsyncd.conf(5) man pages for help
# This line is required by the /etc/init.d/rsyncd script
pid file = /var/run/rsyncd.pid
port = 873
address = 172.23.1.1 #服务器ip地址
#uid = nobody
#gid = nobody
uid = 0
gid = 0
use chroot = no
#limit access to private LANs
hosts allow=172.23.0.0/255.255.0.0 192.168.3.0/255.255.255.0
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
[tongbu] #同步项目名称
path = /data/tongbu
list=yes
ignore errors
#auth users = user
read only = false
#secrets file = /etc/rsync/rsyncd.secrets
comment = back
以上是我的配置文件,因为配置认证没有成功,所以没有配置认证同步了。以后再调试认证同步。
启动rsync
rsync --daemon --config=/etc/rsync/rsync.conf
修改防火墙,开放tcp 873端口
vi /etc/sysconfig/iptables
-A INPUT -m state --state NEW -m tcp -p tcp --dport 873 ls-j ACCEPT
重启防火墙
service iptables restart
配置开机自动启动rsync
vi /etc/rc.d/rc.local
在后面加一句
/usr/bin/rsync --daemon --config=/etc/rsync/rsync.conf
vi rsync.secrets
user:password
客户端上传到服务器:
rsync.exe -uvzrtp --progress --delete /cygdrive/d/work/ user@172.23.1.1::tongbu
客户端从服务器下载:
rsync.exe -uvzrtp --progress --delete user@172.23.1.1::tongbu /cygdrive/d/work/