服务版本说明
服务 版本号 备注
rsync rsync-3.1.3
inotify-tools inotify-tools-3.14
部署环境
系统环境:centos7.6
主机名:yhcs_1、yhcs_2
IP:192.168.43.176、192.168.43.177
下载路径
rsync下载:https://download.samba.org/pub/rsync/
inotify-tools下载:https://github.com/rvoicilas/inotify-tools/wiki
安装约定并创建目录
安装包存放目录:/data/software/rsync
安装包存放目录:/data/software/inotify-tools
安装目录:/usr/local/rsync
安装目录:/usr/local/inotify-tools
同步目录:/data/backup
[root@yhcs_1 ~]# mkdir -p /data/software/rsync
[root@yhcs_1 ~]# mkdir -p /data/software/inotify-tools
[root@yhcs_1 ~]# mkdir -p /data/backup
上传tar包并解压
[root@yhcs_1 ~]# cd /data/software/rsync
[root@yhcs_1 rsync]# rz -E
rz waiting to receive.
[root@yhcs_1 rsync]# tar -zxvf rsync-3.1.3.tar.gz
[root@yhcs_1 rsync]# cd /data/software/inotify-tools
[root@yhcs_1 inotify-tools]# rz -E
rz waiting to receive.
[root@yhcs_1 inotify-tools]# tar -zxvf inotify-tools-3.14.tar.gz
编译安装
[root@yhcs_1 rsync]# cd rsync-3.1.3
[root@yhcs_1 rsync-3.1.3]# ./configure --prefix=/usr/local/rsync/
[root@yhcs_1 rsync-3.1.3]# make && make install
配置文件(服务端)
[root@yhcs_1 ~]# cat /usr/local/rsync/rsyncd.conf
uid = root
gid = root
use chroot = no
max connections = 4
exclude = lost+found/
transfer logging = yes
timeout = 900
ignore nonreadable = yes
dont compress = .gz .tgz .zip .z .Z .rpm .deb .bz2
read only=yes #只读模式,后面部署inotify实时同步时需要改成false
write only=no
hosts allow=192.168.43.0/24
[databackup]
path = /data/backup/
list=no
ignore errors