Chinaunix首页 | 论坛 | 博客
  • 博客访问: 8450
  • 博文数量: 1
  • 博客积分: 91
  • 博客等级: 民兵
  • 技术积分: 20
  • 用 户 组: 普通用户
  • 注册时间: 2012-08-09 10:15
文章分类
文章存档

2012年(1)

最近访客

分类: LINUX

2012-09-23 17:18:00


一、服务器端配置
# yum -y install xinetd
# vi /etc/xinetd.d/rsync
======================================================
service rsync
{
disable = no
socket_type = stream
wait = no
user = root
server = /usr/bin/rsync
server_args = daemon
log_on_failure += USERID
}
======================================================

#重启服务xinetd,防火墙记得要打开端口,默认端口是873
iptables -A INPUT -s 192.168.0.0/255.255.255.0 -p tcp -m tcp --dport 873 -j ACCEPT
iptables -A INPUT -p tcp -m tcp --dport 873 -j DROP
======================================================
-A INPUT -s 192.168.0.0/24 -p tcp -m tcp --dport 873 -j ACCEPT
======================================================
service xinetd restart

-A INPUT -s 192.168.0.0/24 -p tcp -m tcp --dport 873 -j ACCEPT


#建立rsyncd.conf
vi /etc/rsyncd.conf
======================================================
#Global Settings
uid = webuser
gid = webuser
use chroot = yes
max connections = 20
secrets file = /etc/rsyncd.secrets
log file = /var/log/rsyncd.log
pid file = /var/run/rsyncd.pid
lock file = /var/run/rsync.lock
comment = hello world


[backup]
path = /test
#hosts allow = 192.168.1.183
list = true
======================================================

#访问用户密码设置,暂时不用
vi /etc/rsyncd.secrets (设置访问(认证)的用户名密码)
chown root:root /etc/rsyncd.secrets
chmod 600 /etc/rsyncd.secrets 

二、client 端进行同步
#客户端安装rsync
yum -y install rsync

#执行同步,/test/为源目录,/backtest为目的备份目录
/usr/bin/rsync -vzrtopg --delete --progress /test/  /backtest/

#定时执行同步,每三分钟一次
crontab -e
======================================================
* */1 * * * /usr/bin/rsync -vzrtopg --delete --progress /test/  /backtest/
======================================================

 

 

 

 

 

 

 

阅读(1129) | 评论(0) | 转发(0) |
0

上一篇:没有了

下一篇:没有了

给主人留下些什么吧!~~