作用说明:
员工传输数据:好回复 定时备份(最短周期1分钟)
用户传输数据:难恢复 实时备份
实时同步原理:
1.发现新的数据信息 inotify
2.将新的数据进行传输 rsync
3.发行数据过程+数据传输过程 ==实时同步
inotify+sersync == 脚本/sersync
inotify软件介绍
监控数据变化软件,变化信息成为事件(创建 修改 删除 移动)
inotify软件部署:前提 epel源
curl -o /etc/yum.repos.d/epel.repo
http://mirrors.aliyun.com/repo/epel-7.repo
yum install -y inotify-tools --->安装在存储服务器
inotify软件应用:
rpm -qa inotify-tools
rpm -ql inotify-tools
/usr/bin/inotifywait *** ---监控数据变化命令
/usr/bin/inotifywatch ---对变化的事件信息进行统计
监控命令使用方法
-h|--help Show this help text. --exclude <pattern> Exclude all events on files matching the extended regular expression <pattern>. 排除指定数据信息不用进行监控 --excludei <pattern> Like --exclude but case insensitive. 排除指定数据信息不用进行监控(对数据信息忽略大小写) -m|--monitor Keep listening for events forever. Without this option, inotifywait will exit after one event is received. 一直处于监控状态 -d|--daemon Same as --monitor, except run in the background logging events to a file specified by --outfile. Implies --syslog. -r|--recursive Watch directories recursively. 监控指定目录下面数据变化, 还可以监控目录中子目录里面数据变化 递归监控 -q|--quiet Print less (only print events). 尽量输出少的信息 -qq Print nothing (not even events). 什么都不输出 --format <fmt> Print using a specified printf-like format string; read the man page for more details. 定义输出格式信息 --timefmt <fmt> strftime-compatible format string for use with %T in --format string. 定义时间格式信息 -e|--event <event1> [ -e|--event <event2> ... ] Listen for specific event(s). If omitted, all events are listened for. 监听指定事件信息 inotifywait命令语法格式 inotifywait 参数信息 监听数据(目录) 标准命令用法: inotifywait -mrq /data /data/oldboy01/ CREATE olddog.txt /data/oldboy01/ OPEN olddog.txt /data/oldboy01/ ATTRIB olddog.txt /data/oldboy01/ CLOSE_WRITE,CLOSE olddog.txt