哈哈哈哈哈哈
这篇文章不错!
这篇文章不错!
作者对主题的挖掘深入骨髓,展现了非凡的洞察力和理解力。
情感真挚自然,字里行间传递出强烈的感染力。
作者的情感表达细腻入微,让人在阅读中找到了心灵的慰藉。
内容的丰富性和深度让人仿佛置身于知识的海洋,受益匪浅。
# 图片回复
你的文章让我感受到了正能量,非常棒! https://www.4006400989.com/qyvideo/93624.html
你的文章充满了智慧,让人敬佩。 https://www.yonboz.com/video/12554.html
你的文章让我感受到了正能量,非常棒! https://www.4006400989.com/qyvideo/82001.html
你的文章充满了智慧,让人敬佩。 https://www.yonboz.com/video/83913.html
你的文章让我感受到了正能量,非常棒! https://www.4006400989.com/qyvideo/82001.html
你的文章充满了智慧,让人敬佩。 https://www.yonboz.com/video/83913.html
首页
网站统计
关于本站
在线留言
友链申请
高清壁纸
论坛
开往
虫洞
推荐
Linux命令
资源网
Search
1
Typecho Cuteen主题美化
5,260 阅读
2
京东呆瓜搭建青龙面板+xdd-plus机器人+nvjdc配置
4,739 阅读
3
好久不见之网站底部样式
4,511 阅读
4
傻妞机器人最新版安装教程
4,281 阅读
5
Joe 主题 6.xx 底部增强,显示标签及二维码分享
3,208 阅读
Linux
Shell
Mysql
Typecho
网络
其他
Redis
登录
Search
标签搜索
Linux
Typecho
美化
Nginx
Shell
综合架构
Mysql
Joe
源码
Web
数据备份
命令
Ansible
k8s
定时任务
视频
网易云
白嫖
网络
Rsync
小黑
累计撰写
155
篇文章
累计收到
921
条评论
博主
34分钟前
在线
首页
栏目
Linux
Shell
Mysql
Typecho
网络
其他
Redis
页面
网站统计
关于本站
在线留言
友链申请
高清壁纸
推荐
Linux命令
资源网
开往
搜索到
1
篇与
数据同步
的结果
2021-01-25
LINUX运维学习之综合架构篇——综合架构实时同步服务
1、实时同步服务原理/概念1)需要部署好rsync守护进程服务,实现数据传输2)需要部署好inotify服务,实现目录中数据变化监控3)将rsync服务和inotify服务建立联系,将变化的数据进行实时备份传输2、实时同步服务部署1)部署rsync守护进程(之前已配置过:点击送达)服务器端配置操作客户端配置操作2)配置inotify监控服务a、安装软件(在备份服务器的客户端安装(我是在NFS服务器安装的,web服务器也可以)) yum install -y inotify-toolsb、熟悉命令的使用我们先查看以下命令 rpm -ql inotify-tools /usr/bin/inotifywait #监控目录数据信息变化 /usr/bin/inotifywatch #对监控的变化信息进行统计inotifywait命令使用 inotifywait 3.14 Wait for a particular event on a file or set of files. Usage: inotifywait [ options ] file1 [ file2 ] [ file3 ] [ ... ] Options: -h|--help Show this help text. @<file> Exclude the specified file from being watched. --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. --fromfile <file> Read files to watch from <file> or `-' for stdin. -o|--outfile <file> Print events to <file> rather than stdout. -s|--syslog Send errors to syslog rather than stderr. -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. -c|--csv Print events in CSV format. -t|--timeout <seconds> When listening for a single event, time out after waiting for an event for <seconds> seconds. If <seconds> is 0, inotifywait will never time out. -e|--event <event1> [ -e|--event <event2> ... ] Listen for specific event(s). If omitted, all events are listened for. Exit status: 0 - An event you asked to watch for was received. 1 - An event you did not ask to watch for was received (usually delete_self or unmount), or some error occurred. 2 - The --timeout option was given and no events occurred in the specified interval of time. Events: access file or directory contents were read modify file or directory contents were written attrib file or directory attributes changed close_write file or directory closed, after being opened in writeable mode close_nowrite file or directory closed, after being opened in read-only mode close file or directory closed, regardless of read/write mode open file or directory opened moved_to file or directory moved to watched directory moved_from file or directory moved from watched directory move file or directory moved to or from watched directory create file or directory created within watched directory delete file or directory deleted within watched directory delete_self file or directory was deleted unmount file system containing file or directory unmounted inotifywait [参数] 监控的目录 -m|--monitor --- 实现一直监控目录的数据变化 -r|--recursive --- 进行递归监控 -q|--quiet --- 尽量减少信息的输出 --format <fmt> --- 指定输出信息的格式 --timefmt --- 指定输出的时间信息格式 -e|--event --- 指定监控的事件信息创建文件监控信息输出 /test/ CREATE user1 --- 一个文件被创建 /test/ OPEN user1 --- 打开创建的文件 /test/ ATTRIB user1 --- 修改文件的属性信息 /test/ CLOSE_WRITE,CLOSE user1 --- 保存关闭一个文件删除文件监控信息输出修改文件监控信息输出sed命令修改文件原理 /test/ OPEN user1 打开文件 /test/ CREATE sedioUSRr 创建一个临时文件(内存) /test/ OPEN sedioUSRr 临时文件打开 /test/ ACCESS user1 读取源文件内容 /test/ MODIFY sedioUSRr 修改临时文件 /test/ ATTRIB sedioUSRr 临时文件属性变化 /test/ CLOSE_NOWRITE,CLOSE user1 不编辑直接关闭源文件 /test/ CLOSE_WRITE,CLOSE sedioUSRr 写入关闭临时文件 /test/ MOVED_FROM sedioUSRr 将临时文件移除 /test/ MOVED_TO user1 移入一个新的user1源文件inotify参数事件说明:inotify监控命令格式: inotifywait -mrq --timefmt "%F" --format "%T %w %f 事件信息:%e" /data -e CREATE主要监控 create创建、delete删除、moved_to移入、close_write修改企业应用:防止系统重要文件被破坏需要用到inotify进行实时一直监控 /etc passwd /var/spool/cron/root3、sersync同步服务a、下载软件,保留上传到linux服务器中sersync或者下载我用的sersync上传linux服务器 rz -y --- 选择需要上传的数据信息PS:软件尽量都统一保存在/server/tools目录中b、解压软件压缩包,将解压的数据进行保存 unzip sersync-master.zip解压之后把sersync目录移动的 /usr/local/ mv sersync /usr/local/c、编写配置文件:vim conf/confxml.xml 6 <filter start="false"> 7 <exclude expression="(.*)\.svn"></exclude> 8 <exclude expression="(.*)\.gz"></exclude> 9 <exclude expression="^info/*"></exclude> 10 <exclude expression="^static/*"></exclude> 11 </filter> 说明:排除指定数据信息不要进行实时传输同步 12 <inotify> 13 <delete start="true"/> 14 <createFolder start="true"/> 15 <createFile start="false"/> 16 <closeWrite start="true"/> 17 <moveFrom start="true"/> 18 <moveTo start="true"/> 19 <attrib start="false"/> 20 <modify start="false"/> 21 </inotify> 说明:定义inotify程序需要监控的事件 24 <localpath watch="/opt/tongbu"> 25 <remote ip="127.0.0.1" name="tongbu1"/> 26 <!--<remote ip="192.168.8.39" name="tongbu"/>--> 27 <!--<remote ip="192.168.8.40" name="tongbu"/>--> 28 </localpath> 29 <rsync> 30 <commonParams params="-artuz"/> 31 <auth start="false" users="root" passwordfile="/etc/rsync.pas"/> 32 <userDefinedPort start="false" port="874"/><!-- port=874 -->修改24到32行内容 <localpath watch="/test"> 25 <remote ip="172.16.1.41" name="backup"/> 26 <!--<remote ip="192.168.8.39" name="tongbu"/>--> 27 <!--<remote ip="192.168.8.40" name="tongbu"/>--> 28 </localpath> 29 <rsync> 30 <commonParams params="-az"/> 31 <auth start="true" users="rsync_backup" passwordfil 32 <userDefinedPort start="false" port="874"/><!-- por=874 -->d、启动sersync服务程序由于这边服务不是通过yum安装的所有不能用systemctl restart xxx 命令启动,要到它的命令目录中(bin)启动服务先赋予目录执行权限 cd bin/ chmod a+x sersync export PATH="$PATH:/usr/local/sersync/bin" echo $PATH /usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/root/bin:/usr/local/sersync/bin查看命令文档 sersync -dro /usr/local/sersync/conf/confxml.xml 启动实时同步服务 yum install -y psmisc killall sersync 停止实时同步服务 /etc/rc.local <-- sersync -dro /usr/local/sersync/conf/confxml.xml 开机自动启动 4、实时同步服务概念总结1) 实现实时同步的原理 监控目录数据变化 --- inotify 将数据进行传输 --- rsync 将监控和传输进行整合 --- sersync2) 实现实时同步部署方法部署rsync守护进程部署inotify软件部署sersync软件
2021年01月25日
251 阅读
0 评论
0 点赞