Chinaunix首页 | 论坛 | 博客
  • 博客访问: 1076040
  • 博文数量: 120
  • 博客积分: 887
  • 博客等级: 准尉
  • 技术积分: 1883
  • 用 户 组: 普通用户
  • 注册时间: 2010-04-05 21:10
个人简介

RHCE,CCNA,熟悉shell脚本

文章分类

全部博文(120)

文章存档

2015年(16)

2014年(20)

2013年(48)

2012年(20)

2011年(16)

分类: LINUX

2012-07-06 09:41:46

server1 与 server2 同步
rsync 不仅仅速度快,-a参数可将server端文件权限、属主全部照搬到client端。而且不占服务器资源

### server1 配置  //作为server
[root@server1 solr]# cat /etc/rsyncd.conf
uid = nobody
gid = nobody
hosts allow = 192.168.0.4
use chroot = no
read only = no
secrets file = /etc/rsyncd.secrets  #密码存在哪个文件
log file = /var/log/rsyncd.log
pid file = /var/run/rsyncd.pid

[data]
path = /var/www/html/data

[root@server1 solr]# cat /etc/rsyncd.secrets
root:123456


[root@server1 solr]# rsync --daemon

##server2 配置 //作为client
## rsync dest src
## rsync src dest

[root@webserver2 solr]# rsync -auz --delete 192.168.0.3::data /var/www/html/data
## -aRrvz   同步原有文件的权限

值得注意的是-P这个参数是综合了--partial --progress两个参数,所以rsync的断点续传可以
[root@webserver2 solr]# rsync -auPRz --delete 192.168.0.3::data /var/www/html/data

RSYNC同步时报错
rsync: failed to set times on "htdocs" (in frsync): Operation not permitted (1)
htdocs/text.txt
rsync: mkstemp "htdocs/.text.txt.1kijFx" (in frsync) failed: Permission denied (13)

解决:
修改uid,gid ,比如修改成apache
uid = nobody  ==》 uid = apache
gid = nobody  ==》 gid = apache




阅读(1133) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~