实时复制实践:
前提是:backup的rsync服务端部署完成。
1、配置NFS客户端
[root@nfs ~]#
echo 'export RSYNC_PASSWORD=123456'>>/etc/bashrc
[root@nfs ~]# source /etc/bashrc
[root@nf ~]# echo $RSYNC_PASSWORD
123456
推送测试
2、查看inotify支持情况
3、安装inotify-tools
[root@nfs/]# yum install epel-release -y
[root@nfs/]# yum install inotify-tools -y
4、命令参数和事件知识
5、测试实践
inotifywait -mrq --timefmt '%d/%m/%y %H:%M' --format '%T %w%f' -e create /data
6、实现数据复制
[root@nfs ~]# inotifywait -mrq --format '%w%f' -e close_write,delete /data
/data/a.txt
/data/a.txt
/data/a.txt
ersync实践:
1)客户端推送成功
rsync -az /data [email protected]::backup
2)部署sersync服务(NFS)
wget https://github.com/wsgzao/sersync/blob/master/sersync2.5.4_64bit_binary_stable_final.tar.gz
[root@nfs /server/tools]# mkdir /application -p
[root@nfs /server/tools]# mv application/sersync /application/
[root@nfs /server/tools]# tree /application/
/application/
└── sersync
├── bin
│ └── sersync
├── conf
│ ├── confxml.xml
│ └── confxml.xml.ori
├── logs
│ └── rsync_fail_log.sh
└── readme.txt
4 directories, 5 files
[root@nfs /server/tools]# cd /application/sersync/
[root@nfs /application/sersync]# ls
bin conf logs readme.txt
[root@nfs /application/sersync]# cd conf/
[root@nfs /application/sersync/conf]# ls
confxml.xml confxml.xml.ori
3)sersync配置文件:干两件事:
1)完成监控配置:
inotifywait -mrq --format '%w%f' -e createFolder,close_write,delete,moveFrom,moveTo /data
2)完整命令拼接:
rsync -az /data --timeout=100 [email protected]::backup
4、启动服务
[root@nfs /application/sersync/conf]# ../bin/sersync -h启动服务
set the system param
execute:echo 50000000 > /proc/sys/fs/inotify/max_user_watches
execute:echo 327679 > /proc/sys/fs/inotify/max_queued_events
parse the command param