哈哈哈哈哈哈
这篇文章不错!
这篇文章不错!
作者对主题的挖掘深入骨髓,展现了非凡的洞察力和理解力。
情感真挚自然,字里行间传递出强烈的感染力。
作者的情感表达细腻入微,让人在阅读中找到了心灵的慰藉。
内容的丰富性和深度让人仿佛置身于知识的海洋,受益匪浅。
# 图片回复
你的文章让我感受到了正能量,非常棒! 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,129 阅读
2
京东呆瓜搭建青龙面板+xdd-plus机器人+nvjdc配置
4,597 阅读
3
好久不见之网站底部样式
4,237 阅读
4
傻妞机器人最新版安装教程
4,108 阅读
5
Joe 主题 6.xx 底部增强,显示标签及二维码分享
3,114 阅读
Linux
Shell
Mysql
Typecho
网络
其他
Redis
登录
Search
标签搜索
Linux
Typecho
美化
Nginx
Shell
综合架构
Mysql
Joe
源码
Web
数据备份
命令
Ansible
k8s
定时任务
视频
网易云
白嫖
网络
Rsync
小黑
累计撰写
155
篇文章
累计收到
921
条评论
博主
4月14日
在线
首页
栏目
Linux
Shell
Mysql
Typecho
网络
其他
Redis
页面
网站统计
关于本站
在线留言
友链申请
高清壁纸
推荐
Linux命令
资源网
开往
搜索到
3
篇与
Rsync
的结果
2021-05-18
Rsync命令
什么事Rsync服务rsync是一款开源的,快速的,多功能的可以实现全量及增量的本地或远程数据同步备份的工具yum install -y rsyncrsync命令1、本地备份,同cp一样rsync /etc/host /backup2、远程备份,同scp一样 (172.16.1.41 备份服务器)scp -rp /etc/host root@172.16.1.41:/backup ps: -r 递归 -p 保持文件属性不变 rsync -rp /etc/host root@172.16.1.41:/backup/host远程备份目录rsync -rp /etc root@172.16.1.41:/backup ----备份目录后面没有/ ,会备份/etc目录及其内容 rsync -rp /etc/ root@172.16.1.41:/backup ----备份目录后面有/ ,会备份/etc目录里面的内容3、代替删除命令 首先我们创建一个空目录 mkdir /nullrsync -rp --delete /null root@172.16.1.41:/backup--delete 实现无差异同步数据4、查看文件命令,同lsrsync /etc/hostsrsync -rp root@172.16.1.41:/etc/host /backup --从备份服务器拉取数据 rsync -rp /etc/host root@172.16.1.41:/backup --从本地传输数据
2021年05月18日
377 阅读
0 评论
2 点赞
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日
244 阅读
0 评论
0 点赞
2021-01-08
守护进程服务在企业应用
1、守护进程多模块功能配置 sa sa_data.txt dev dev_data.txt dba dba_data.txt vim /etc/rsync.conf #添加以下信息 [backup] comment = "backup dir by oldboy" path = /backup [dba] comment = "backup dir by oldboy" path = /dba [dev] comment = "backup dir by oldboy" path = /devdata2、守护进程的排除环境 [root@nfs01 /]# mkdir -p /oldboy [root@nfs01 /]# mkdir -p /oldboy/{a..c} [root@nfs01 /]# touch /oldboy/{a..c}/{1..3}.txt [root@nfs01 /]# tree /oldboy /oldboy ├── 01.txt ├── 02.txt ├── a │?? ├── 1.txt │?? ├── 2.txt │?? └── 3.txt ├── b │?? ├── 1.txt │?? ├── 2.txt │?? └── 3.txt └── c ├── 1.txt ├── 2.txt └── 3.txt01、 需求01: 将/oldboy目录下面 a目录数据全部备份 b目录不要备份1.txt文件 c整个目录不要做备份 --exclude=PATTERN 绝对路径方式: [root@nfs01 /]# rsync -avz /oldboy --exclude=/oldboy/b/1.txt --exclude=/oldboy/c/rsync_backup@172.16.1.41::backup --password-file=/etc/rsync.password sending incremental file list oldboy/ oldboy/01.txt oldboy/02.txt oldboy/a/ oldboy/a/1.txt oldboy/a/2.txt oldboy/a/3.txt oldboy/b/ oldboy/b/2.txt oldboy/b/3.txt 相对路径方式: [root@nfs01 /]# rsync -avz /oldboy --exclude=b/1.txt --exclude=c/ rsync_backup@172.16.1.41::backup --password-file=/etc/rsync.password sending incremental file list oldboy/ oldboy/01.txt oldboy/02.txt oldboy/a/ oldboy/a/1.txt oldboy/a/2.txt oldboy/a/3.txt oldboy/b/ oldboy/b/2.txt oldboy/b/3.txt sent 502 bytes received 177 bytes 1,358.00 bytes/sec total size is 0 speedup is 0.0002、将/oldboy目录下面 a目录数据全部备份 b目录不要备份1.txt文件 c整个目录1.txt 3.txt文件不要备份 --exclude-from=file --- 批量排除 第一个历程: 编辑好一个排除文件 [root@nfs01 /]# cat /oldboy/exclude.txt b/1.txt c/1.txt c/3.txt exclude.txt第二个历程: 实现批量排除功能 [root@nfs01 /]# rsync -avz /oldboy --exclude-from=/oldboy/exclude.txt rsync_backup@172.16.1.41::backup --password-file=/etc/rsync.password sending incremental file list oldboy/ oldboy/01.txt oldboy/02.txt oldboy/a/ oldboy/a/1.txt oldboy/a/2.txt oldboy/a/3.txt oldboy/b/ oldboy/b/2.txt oldboy/b/3.txt oldboy/c/ oldboy/c/2.txt03、守护进程来创建备份目录 [root@nfs01 /]# rsync -avz /etc/hosts rsync_backup@172.16.1.41::backup/10.0.0.31/ --password-file=/etc/rsync.password sending incremental file list created directory 10.0.0.31 hosts sent 226 bytes received 75 bytes 602.00 bytes/sec total size is 371 speedup is 1.23PS: 客户端无法在服务端创建多级目录 3、 守护进程的访问控制配置守护进程白名单和黑名单功能PS: 建议只使用一种名单守护进程的列表功能配置 [root@nfs01 /]# rsync rsync_backup@172.16.1.41:: backup "backup dir by oldboy" dba "backup dir by oldboy" dev "backup dir by oldboy"
2021年01月08日
201 阅读
0 评论
0 点赞