linux运维、架构之路-实时同步方案
一、inotify+rsync实时同步 1、介绍 inotify-tools是一种强大的、细粒度的、异步的文件系统事件监控机制,可以用来监控文件系统的事件。inotify-tools是用c编写的,除了要求内核支持inotify外,不依赖于其他。inotify-tools提供两种工具,一是inotifywait,它是用来监控文件或目录的变化,二是inotifywatch,它是用来统计文件系统访问的次数。 2、实现原理 3、根据原理进行部署 ①查看系统是否支持inotify [root@nfs-nfs01 ~]# ll /proc/sys/fs/inotify/ -rw-r--r-- 1 root root 0 Aug 22 18:13 max_queued_events -rw-r--r-- 1 root root 0 Aug 28 14:30 max_user_instances -rw-r--r-- 1 root root 0 Aug 22 18:13 max_user_watches ②软件安装 wget -O /etc/yum.repos.d/epel.repo http://mirrors.aliyun.com/repo/epel-6.repo #安装epel源才可以yum安装inotify yum install -y inotify-tools ③