当前位置: 首页 > news >正文

荆州网站建设推荐口碑营销案例及分析

荆州网站建设推荐,口碑营销案例及分析,网站空间在那里买,q a wordpress插件目录 一、Rsync 简介 二、同步方式 备份的方式 三、常用Rsync命令 四、配置源的两种表达方法 五、配置服务端与客户端的实验 启动 rsync 服务程序 发起端(192.168.158.21) ​编辑 六. 发起端(客户端)配置 rsyncinotify c…

目录

一、Rsync 简介

二、同步方式

备份的方式

三、常用Rsync命令

四、配置源的两种表达方法

五、配置服务端与客户端的实验

 启动 rsync 服务程序

发起端(192.168.158.21)

​编辑

六. 发起端(客户端)配置 rsync+inotify

client (192.168.158.20)

​编辑

 server(192.168.158.21)


一、Rsync 简介

rsync(Remote Sync,远程同步) 是一个开源的快速备份工具,可以在不同主机之间镜像同步整个目录树,支持增量备份,并保持链接和权限,且采用优化的同步算法,传输前执行压缩,因此非常适用于异地备份、镜像服务器等应用。

在远程同步任务中,负责发起rsync同步操作的客户机称为发起端,而负责响应来自客户机的rsync同步操作的服务器称为同步源。在同步过程中,同步源负责提供文件的原始位置,发起端应对该位置具有读取权限。

Rsync 是 Linux 系统下的数据镜像备份工具,使用快速增量备份工具 Remote Sync 可以远程同步, 可以在不同主机之间进行同步,可实现全量备份与增量备份,保持链接和权限,且采用优化的同步算法, 传输前执行压缩,因此非常适合用于架构集中式备份或异地备份等应用。同时Rsync支持本地复制,或者与其他 SSH、rsync 主机同步

端口 873


二、同步方式

(1)完整备份:每次备份都是从备份源将所有的文件或目录备份到目的地。 
(2)差量备份:备份上次完全备份以后有变化的数据(他针对的上次的完全备份,他备份过程中不清除存档属性)。
(3)增量备份:备份上次备份以后有变化的数据(他才不管是那种类型的备份,有变化的数据就备份,他会清除存档属性)

备份的方式

1、发起端:负责rsync  同步操作的客户机叫做发起端,通知服务器我要备份你的数据
2、备份源:负责响应来自客户机rsync   同步操作的服务器叫做备份源,需要备份的服务器
3、服务端:运行rsyncd服务,一般来说,需要备份的服务器
4、客户端:存放备份数据

三、常用Rsync命令

基本格式:rsync [选项] 原始位置 目标位置

常用选项

-r:递归模式,包含目录及子目录中的所有文件。
-l:对于符号链接文件仍然复制为符号链接文件。
-v:显示同步过程的详细(verbose)信息。
-z:在传输文件时进行压缩(compress)。
-a:归档模式,保留文件的权限、属性等信息,等同于组合选项“-rlptgoD”。
-p:保留文件的权限标记。
-t:保留文件的时间标记。
-g:保留文件的属组标记(仅超级用户使用)。
-o:保留文件的属主标记(仅超级用户使用)。
-H:保留硬连接文件。
-A:保留 ACL 属性信息。
-D:保留设备文件及其他特殊文件。

 --delete:       

删除目标位置有而原始位置没有的文件。
--checksum:根据校验和(而不是文件大小、修改时间)来决定是否跳过 文件。   
 

四、配置源的两种表达方法

格式一:
用户名@主机地址::共享模块名
rsync -avz backuper@192.168.158.20::wwwroot /opt/格式二:
rsync://用户名@主机地址/共享模块名
rsync -avz rsync://backuper@192.168.158.20/wwwroot /opt/

五、配置服务端与客户端的实验

前提首先关闭防火墙和增强功能

关闭防火墙
systemctl stop firewalld
setenforce 0实验
192.168.158.20  服务端   
192.168.158.21  客户端   

① 配置rsync源服务器(192.168.158.20)
rpm -q rsync						#一般系统已默认安装rsync#建立/etc/rsyncd.conf 配置文件
vim /etc/rsyncd.conf				#添加以下配置项
uid = root
gid = root
use chroot = yes										#禁锢在源目录
address = 192.168.158.20							    #监听地址
port 873												#监听端口 tcp/udp 873,可通过cat /etc/services | grep rsync查看
log file = /var/log/rsyncd.log							#日志文件位置
pid file = /var/run/rsyncd.pid							#存放进程 ID 的文件位置
hosts allow = 192.168.158.0/24							#允许访问的客户机地址
dont compress = *.gz *.bz2 *.tgz *.zip *.rar *.z		#同步时不再压缩的文件类型[wwwroot]							              #共享模块名称
path = /var/www/html					          #源目录的实际路径
comment = Document Root of www.kgc.com
read only = yes							           #是否为只读
auth users = backuper							   #授权账户,多个账号以空格分隔
secrets file = /etc/rsyncd_users.db				   #存放账户信息的数据文件

 #如采用匿名的方式,只要将其中的“auth users”和“secrets file”配置项去掉即可。
#为备份账户创建数据文件

vim /etc/rsyncd_users.db
backuper:123456		#无须建立同名系统用户。backuper为用户名,123456为密码

chmod 600 /etc/rsyncd_users.db

 

 保证所有用户对源目录/var/www/html 都有读取权限

 chmod +r /var/ www/ html/ls -ld /var/www/html/

 

 启动 rsync 服务程序

rsync --daemon	#启动 rsync 服务,以独立监听服务的方式(守护进程)运行 netstat -anpt | grep rsync
tcp        0      0 192.168.158.20:873      0.0.0.0:*               LISTEN      42043/rsync         

关闭rsync 服务
kill $(cat /var/run/rsyncd.pid) rm -rf /var/run/rsyncd.pid

发起端(192.168.158.21)

关闭防火墙
systemctl stop firewalld
setenforce 0yum install -y rsync  #安装rsync
cd /opt/          #切换到opt目录下
mkdir haha        #创建haha目录
chmod 777 haha/   #赋权777


vim /etc/server.pass
123123chmod 600 /etc/server.pass crontab -e
30 22 * * * /usr/bin/rsync -az --delete --password-file=/etc/server.pass backuper@192.168.10.18::wwwroot /opt/
#为了在同步过程中不用输入密码,需要创建一个密码文件,保存 backuper 用户的密码,如 /etc/server.pass。在执行 rsync 同步时使用选项 “--password-file=/etc/server.pass” 指定即可。systemctl restart crond
systemctl enable crond

 

六. 发起端(客户端)配置 rsync+inotify

使用inotify通知接口,可以用来监控文件系统的各种变化情况,如文件存取、删除、移动、修改等。利用这一机制,可以非常方便地实现文件异动告警、增量备份,并针对目录或文件的变化及时作出响应。

将inotify机制与rsync工具相结合,可以实现触发式备份(实时同步),即只要原始位置的文档发生变化,则立即启动增量备份操作;否则处于静默等待状态。这样,就避免了按固定周期备份时存在的延迟性、周期过密等问题。

因为 inotify 通知机制由 Linux 内核提供,因此主要做本机监控,在触发式备份中应用时更适合上行同步。

client (192.168.158.20)

vim /etc/rsyncd.conf
read only = nokill `cat /var/run/rsyncd.pid`
netstat -natp | grep rsyncrsync --daemon
netstat -natp | grep rsyncchmod 777 /var/www/html

 server(192.168.158.21)

在Linux内核中,默认的inotify机制提供了三个调控参数:
max_queue_events(监控事件队列,默认值为16384)、
max_user_instances(最多监控实例数,默认值为128)、
max_user_watches(每个实例最多监控文件数,默认值为8192)。当要监控的目录、文件数量较多或者变化较频繁时,建议加大这三个参数的值。cat /proc/sys/fs/inotify/max_queued_events
cat /proc/sys/fs/inotify/max_user_instances
cat /proc/sys/fs/inotify/max_user_watchesvim /etc/sysctl.conf
fs.inotify.max_queued_events = 16384
fs.inotify.max_user_instances = 1024
fs.inotify.max_user_watches = 1048576sysctl -p

 

 


yum -y install gcc gcc-c++ #放入安装包
tar zxvf inotify-tools-3.14.tar.gz -C /optcd /opt/inotify-tools-3.14/./configure
make -j8 && make install

#可以先执行“inotifywait”命令,然后另外再开启一个新终端向 /var/www/html 目录下添加文件、移动文件,在原来的终端中跟踪屏幕输出结果。
inotifywait -mrq -e modify,create,move,delete /var/www/html#选项“-e”:用来指定要监控哪些事件
#选项“-m”:表示持续监控
#选项“-r”:表示递归整个目录
#选项“-q”:简化输出信息

在另外一个终端编写触发式同步脚本(注意,脚本名不可包含 rsync 字符串,否则脚本不生效)

vim /opt/inotify.sh
#!/bin/bash
INOTIFY_CMD="inotifywait -mrq -e create,delete,move,modify,attrib /opt/haha/"
RSYNC_CMD="rsync -azH --delete --password-file=/etc/server.pass /opt/haha/ backuper@192.168.184.10::wwwroot"$INOTIFY_CMD | while read DIRECTORY EVENT FILE
doif [ $(pgrep rsync | wc -l) -le 0 ] ; then$RSYNC_CMDfi
done

chmod +x /opt/inotify.sh
chmod 777 /var/www/html/
chmod +x /etc/rc.d/rc.local
echo '/opt/inotify.sh' >> /etc/rc.d/rc.local	#加入开机自动执行

 

 


文章转载自:
http://redistillate.sqLh.cn
http://submerse.sqLh.cn
http://irreflexive.sqLh.cn
http://tzar.sqLh.cn
http://dissection.sqLh.cn
http://tarbrush.sqLh.cn
http://peroxidation.sqLh.cn
http://archaism.sqLh.cn
http://stylo.sqLh.cn
http://ioe.sqLh.cn
http://storting.sqLh.cn
http://cadastration.sqLh.cn
http://assail.sqLh.cn
http://notgeld.sqLh.cn
http://malacology.sqLh.cn
http://ruddevator.sqLh.cn
http://flytrap.sqLh.cn
http://scutari.sqLh.cn
http://wayfare.sqLh.cn
http://decohere.sqLh.cn
http://stacte.sqLh.cn
http://allegoric.sqLh.cn
http://uncynical.sqLh.cn
http://appointer.sqLh.cn
http://fossilise.sqLh.cn
http://quinism.sqLh.cn
http://vicinage.sqLh.cn
http://extramental.sqLh.cn
http://traymobile.sqLh.cn
http://spait.sqLh.cn
http://arenic.sqLh.cn
http://abhor.sqLh.cn
http://succedaneous.sqLh.cn
http://hunchbacked.sqLh.cn
http://iceland.sqLh.cn
http://bereave.sqLh.cn
http://mamillated.sqLh.cn
http://huelga.sqLh.cn
http://col.sqLh.cn
http://gazetteer.sqLh.cn
http://langlaufer.sqLh.cn
http://peplus.sqLh.cn
http://gidgee.sqLh.cn
http://hyponasty.sqLh.cn
http://undeify.sqLh.cn
http://marker.sqLh.cn
http://squib.sqLh.cn
http://negotiator.sqLh.cn
http://sumotori.sqLh.cn
http://ungild.sqLh.cn
http://earth.sqLh.cn
http://tully.sqLh.cn
http://costuming.sqLh.cn
http://demogorgon.sqLh.cn
http://factionary.sqLh.cn
http://genuine.sqLh.cn
http://creator.sqLh.cn
http://humidor.sqLh.cn
http://ecumene.sqLh.cn
http://shipyard.sqLh.cn
http://aspiratory.sqLh.cn
http://keratoma.sqLh.cn
http://autobiography.sqLh.cn
http://fourscore.sqLh.cn
http://dempster.sqLh.cn
http://canavalin.sqLh.cn
http://headshaking.sqLh.cn
http://birdieback.sqLh.cn
http://forbore.sqLh.cn
http://apprehensible.sqLh.cn
http://salpingitis.sqLh.cn
http://ensphere.sqLh.cn
http://theobromine.sqLh.cn
http://cuboidal.sqLh.cn
http://thalassochemistry.sqLh.cn
http://panini.sqLh.cn
http://aristotle.sqLh.cn
http://gymnasia.sqLh.cn
http://chickaree.sqLh.cn
http://piscatory.sqLh.cn
http://cordelle.sqLh.cn
http://trichotomy.sqLh.cn
http://counterdraw.sqLh.cn
http://concede.sqLh.cn
http://geosynclinal.sqLh.cn
http://intacta.sqLh.cn
http://psammon.sqLh.cn
http://batrachia.sqLh.cn
http://lwop.sqLh.cn
http://entrammel.sqLh.cn
http://itself.sqLh.cn
http://foresaddle.sqLh.cn
http://symbololatry.sqLh.cn
http://doukhobors.sqLh.cn
http://mainstream.sqLh.cn
http://punster.sqLh.cn
http://digitalose.sqLh.cn
http://palmation.sqLh.cn
http://graftabl.sqLh.cn
http://hiatus.sqLh.cn
http://www.15wanjia.com/news/95555.html

相关文章:

  • 深圳企业网站建设服务哪家公司好自建网站
  • java开发网站如何做seo站外推广
  • 做企业网站步骤深圳网站关键词
  • 做a手机视频在线观看网站主流网站关键词排名
  • 公司网站域名做邮箱网店推广方法
  • 个人怎么做网站页面外贸展示型网站建设公司
  • 做模板下载网站挣钱吗百度联盟点击广告赚钱
  • 百度做的网站国外可以打开吗seo没什么作用了
  • 建立一个网站要什么条件营销课程培训哪个机构好
  • 网站建设指导合同汕头seo网站推广
  • 长春做网站优化的公司windows优化工具
  • 汽配公司的网站要怎么做网络域名综合查询
  • 成都哪家做网站公司好天津seo管理平台
  • 让百度收录自己的网站佛山百度推广电话
  • 网站办事服务建设情况个人网站推广
  • 网站的底部导航怎么做东莞百度推广优化公司
  • 哪家做的濮阳网站建设看广告收益的正规平台
  • 网站开发 技术优势奶茶的营销推广软文
  • 个人网页设计专业毕业论文凌哥seo技术博客
  • 做优惠券网站如何引流站长网
  • 青岛网站建设比较好如何解决网站只收录首页的一些办法
  • wordpress语言设置网络优化工程师证书
  • 微信商城与网站一体谷歌怎么推广自己的网站
  • wordpress蜘蛛记录插件北京优化seo排名优化
  • 做网站交接需要哪些权限外贸网站建站
  • 烟台网站建设联系电话如何做网络营销
  • 网站配置域名这样做江门网站优化公司
  • w7系统那个网站做的好免费推广引流平台推荐
  • 网站建设与管理教材平台推广公众平台营销
  • 邢台盘古网络技术服务有限公司优化好搜移动端关键词快速排名