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
阅读(1173) | 评论(0) | 转发(0) |