實時復(fù)制實踐:
前提:backup rsync服務(wù)端部署好梁只。
?
##1)部署NFS客戶端
部署命令:
echo'export RSYNC_PASSWORD=oldboy' >>/etc/bashrc
source/etc/bashrc
echo$RSYNC_PASSWORD
結(jié)果:
oldboy
##測試推送
推送:
rsync-avz /data rsync_backup@172.16.1.41::backup/
結(jié)果:
sendingincremental file list
sent164 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
yuminstall epel-release -y
yuminstall 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)測試實踐
inotifywait-mrq --timefmt '%d/%m/%y %H:%M' --format '%T %w%f' -e create /data
##5)編寫腳本
mkdir/server/scripts -p
rsync-az --delete /data/ rsync_backup@172.16.1.41::backup
[root@nfs01/server/scripts]# /bin/sh /server/scripts/monitor1.sh &
[2] 9199
[root@nfs01/server/scripts]# tail -2 /etc/rc.local
########################
/bin/sh/server/scripts/monitor1.sh &