实时复制
1)部署NFS客户端
[root@nfs01 ~]# echo 'export RSYNC_PASSWORD=oldboy' >>/etc/bashrc
[root@nfs01 ~]# source /etc/bashrc
[root@nfs01 ~]# echo $RSYNC_PASSWORD
oldboy
测试推送
[root@nfs01 ~]# rsync -avz /data rsync_backup@172.16.1.41::backup/
sending incremental file list
sent 164 bytes received 25 bytes 126.00 bytes/sec
total size is 0 speedup is 0.00
2)查看inotify支持情况
[root@nfs01 ~]# uname -r
3.10.0-957.5.1.el7.x86_64
[root@nfs01 ~]# ls -l /proc/sys/fs/inotify/
总用量 0
-rw-r--r-- 1 root root 0 4月 19 09:45 max_queued_events
-rw-r--r-- 1 root root 0 4月 19 09:45 max_user_instances
-rw-r--r-- 1 root root 0 4月 19 09:45 max_user_watches
3)安装inotify-tools
yum install epel-release -y
yum install inotify-tools -y
[root@nfs01 ~]# rpm -ql inotify-tools|head -2
/usr/bin/inotifywait
/usr/bin/inotifywatch
[root@nfs01 ~]# rpm -qa inotify-tools
inotify-tools-3.14-8.el7.x86_64
4)命令参数和事件知识
略
5)测试实践
inotifywait -mrq --timefmt '%d/%m/%y %H:%M' --format '%T %w%f' -e create /data
脚本