Chinaunix首页 | 论坛 | 博客
  • 博客访问: 272131
  • 博文数量: 87
  • 博客积分: 4061
  • 博客等级: 上校
  • 技术积分: 1032
  • 用 户 组: 普通用户
  • 注册时间: 2008-09-12 16:28
文章分类

全部博文(87)

文章存档

2012年(1)

2009年(85)

2008年(1)

我的朋友

分类: LINUX

2009-03-03 15:29:12

rsync---完全配置
 
先查看本机是否装有rsync-2.6.3-1软件包
Shell> rpm -qa |grep rsync
 
修改名为/etc/xinetd.d/rsync文件
把disable = yes 改成
disable = no
 
配置远程同步主配置文件rsyncd.conf
Shell> vi /etc/rsyncd.conf
配置成以下内容:
# Global Settings
secrets file = /etc/rsyncd.pwd
uid = nobody
gid = nobody
use chroot= no 
max connections = 4
log file = /var/log/rsyncd.log
pid file = /var/run/rsyncd.pid
lock file = /var/run/rsync.lock
# Share Definitions
[share]
comment = site of foxshare 's directory from 192.168.1.250
path = /var/www/share
auth users = rsync
read only = yes
ignore errors
list = no
 
建立密码认证文件
Shell> vi /etc/ rsyncd.pwd
Rsync:123456
注意密码文件的权限是root用户,而且权限必须是600
 
重新启动超级守护进程
Shell> service xinetd restart
 
如果想让客户机同步服务器的时候不输入密码,则需要在客户机上建立密码文件/etc/ rsyncd.pwd,此密码文件只包含密码,和主服务器的密码一样,并且权限必
须是600。
Shell> more /etc/rsyncd.pwd
123456
 
在客户机上执行rsync命令,以同步主服务器文件
Shell>/usr/bin/rsync -vazu --delete /var/www/share1/  --password-file=/etc/rsyncd.pwd
 
然后,通过crontab设定,让这个命令每10分钟运行一次。
Shell> */10 * * * * /usr/bin/rsync -vazu --delete --progress  /var/www/share1/ --password-file=/etc/rsyncd.pwd
这时,同步文件就开始了。
 
注意:文件同步的时候把文件的权限也同步了,所以需要在服务器和客户机之间需要有相同的uid和gid。
阅读(379) | 评论(0) | 转发(0) |
0

上一篇:cacti安装

下一篇:FreeBSD portsnap 简单使用

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