Linux RSync 搭建
安装:
- yum -y install xinetd
端口开放:
- iptables -A INPUT -p tcp -m state --state NEW -m tcp --dport 873 -j ACCEPT
服务端配置:
- su - root
- vim /etc/rsyncd.conf
pid file = /var/run/rsyncd.pid log file = /var/log/rsyncd.log lock file = /var/run/rsync.lock address = 192.168.1.1 port = 873 uid = root gid = root use chroot = yes hosts allow = 192.168.1.0/255.255.255.0 192.168.2.0/255.255.255.0 hosts deny = * max connections = 4 [videoresource] path = /data/resource read only = no write only = no list = yes ignore errors auth users = root secrets file = /etc/rsyncd.secrets comment = This is 192.168.1.1
- vim /etc/rsyncd.secrets
root:123456
- chmod 600 /etc/rsyncd.secrets
- /usr/bin/rsync --daemon --config=/etc/rsyncd.conf
客户端:
- vim /etc/rsyncd.secrets
123456
- chmod 600 /etc/rsyncd.secrets
测试:
- /usr/bin/rsync --list-only root@192.168.1.1::videoresource --password-file=/etc/rsync.secrets
本地同步:
- /usr/bin/rsync -vzrtopg --progress /data/* /data1/*
上传:
- /usr/bin/rsync -vzrtopg --progress /data/* root@192.168.1.1::videoresource
下载(限速5MB):
- /usr/bin/rsync -vzrtopg --progress --bwlimit=5000 root@192.168.1.1::videoresource/* /data/
参考文献:http://www.cnblogs.com/itech/archive/2009/08/10/1542945.html
参考文献:http://www.linuxidc.com/Linux/2016-10/136143.htm
参考文献:http://sookk8.blog.51cto.com/455855/328076/