首页 > 代码库 > rsync+inotify部署

rsync+inotify部署

测试环境:

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部署