码迷,mamicode.com
首页 > 其他好文 > 详细

rsync+inotify部署

时间:2014-10-27 07:00:25      阅读:144      评论:0      收藏:0      [点我收藏+]

标签:file   images   

测试环境:

RedHat5.9

rsync-3.1.1.tar.gz

IP地址:

本地端:192.168.2.23

远程端:192.168.2.24

同步目录:

/web/data

/images


本地端:

1.安装rsync-3.1.1.tar.gz

  tar zxvf rsync-3.1.1.tar.gz

  cd rsync-3.1.1

  ./configure

  make && make install

2.编辑rsyncd.conf

vi /etc/rsyncd.conf

uid = nobody
gid = nobody
use chroot = no
max connections = 10
strict mode = yes
pid file = /var/run/rsyncd.pid
lock file = /var/lock/rsync.lock
log file = /var/log/rsyncd.log

[web]
path = /web/data
comment = webdata file
read only = no
write only = no
ignore errors
uid = root
gid = root
host deny = *
host allow = 192.168.2.25
list = false
auth users = backup
secrets file  = /etc/server.pass

[images]
path = /images
comment = images file
read only = no
write only = no
ignore errors
uid = root
gid = root
host deny = *
host allow = 192.168.2.25
list = false
auth users = backup
secrets file  = /etc/server.pass

3.建立/etc/server.pass

vi /etc/server.pass

backup:123456

4.开启rsyncd服务

  rsync    --daemon


远程端:

1.建立密码文件,记住这里只写密码,不写用户名

vi  /etc/server.pass

123456

chmod 600 /etc/server.pass [这里请特别注意,由于之前我建立这个文件没有更改文件的权限,一直不能同步数据]


rsync  -vzrtopg  --delete --progress  --exclude "*access*"  --exclude "*debug*" --password-file=/etc/server.pass  db2@192.168.2.23::backup  /backup


2.查看在根目录下是否有/backup目录生成

ls  /backup




本文出自 “常用文档” 博客,请务必保留此出处http://yujianglei.blog.51cto.com/7215578/1568282

rsync+inotify部署

标签:file   images   

原文地址:http://yujianglei.blog.51cto.com/7215578/1568282

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!