二进制sersync部署安装
概述
sersync是基于inotify开发的,类似于inotify-tools的工具
sersync可以记录下被监听目录中发生变化的(包括增加、删除、修改)具体某一个文件或者某一个目录的名字,然后使用rsync同步的时候,只同步发生变化的文件或者目录
rsync+inotify-tools与rsync+sersync架构的区别?
1.rsync+inotify-tools
- inotify只能记录下被监听的目录发生了变化(增,删,改)并没有把具体是哪个文件或者哪个目录发生了变化记录下来;
- rsync在同步的时候,并不知道具体是哪个文件或目录发生了变化,每次都是对整个目录进行同步,当数据量很大时,整个目录同步非常耗时(rsync要对整个目录遍历查找对比文件),因此效率很低
2.rsync+sersync
- sersync可以记录被监听目录中发生变化的(增,删,改)具体某个文件或目录的名字;
- rsync在同步时,只同步发生变化的文件或目录(每次发生变化的数据相对整个同步目录数据来说很小,rsync在遍历查找对比文件时,速度很快),因此效率很高。
总结:
当同步的目录数据量不大时,建议使用rsync+inotify
当同步的目录数据量很大时(几百G甚至1T以上)文件很多时,建议使用rsync+sersync
安装sersync
sersync 下载地址,验证码【 eh2b 】
安装步骤
- [root@nfs01 ~]# unzip sersync_installdir_64bit.zip
- [root@nfs01 ~]# ls
- anaconda-ks.cfg sersync_installdir_64bit sersync_installdir_64bit.zip
- [root@nfs01 ~]# mv sersync_installdir_64bit/sersync/ /usr/local/sersync
配置文件修改
- [root@nfs01 sersync]# ls
- bin conf logs
- [root@nfs01 sersync]# vim conf/confxml.xml
- <?xml version="1.0" encoding="ISO-8859-1"?>
- <head version="2.5">
- <host hostip="localhost" port=""></host>
- #开启调试模式
- <debug start="true"/>
- <fileSystem xfs="false"/>
- #指定排除数据信息, 不进行实时同步
- <filter start="false">
- <exclude expression="(.*)\.svn"></exclude>
- <exclude expression="(.*)\.gz"></exclude>
- <exclude expression="^info/*"></exclude>
- <exclude expression="^static/*"></exclude>
- </filter>
- <inotify>
- # 指定inotify程序监控事件信息
- <delete start="true"/>
- <createFolder start="true"/>
- <createFile start="false"/>
- <closeWrite start="true"/>
- <moveFrom start="true"/>
- <moveTo start="true"/>
- <attrib start="false"/>
- <modify start="false"/>
- </inotify>
- <sersync>
- <localpath watch="/opt/tongbu"> #备份文件位置
- <remote ip="127.0.0.1" name="tongbu1"/> #IP地址,模块名称
- <!--<remote ip="192.168.8.39" name="tongbu"/>-->
- <!--<remote ip="192.168.8.40" name="tongbu"/>-->
- </localpath>
- <rsync>
- <commonParams params="-artuz"/> #rsync选项
- <auth start="true" users="rsync_backup" passwordfile="/etc/rsync.password"/> #auth users 位置 | 密码文件位置
- <userDefinedPort start="false" port=""/><!-- port= -->
- <timeout start="false" time=""/><!-- timeout= -->
- <ssh start="false"/>
- </rsync>
- <failLog path="/tmp/rsync_fail_log.sh" timeToExecute=""/><!--default every 60mins execute once-->
- <crontab start="false" schedule=""><!--600mins-->
- <crontabfilter start="false">
- <exclude expression="*.php"></exclude>
- <exclude expression="info/*"></exclude>
- </crontabfilter>
- </crontab>
- <plugin start="false" name="command"/>
- </sersync>
- <plugin name="command">
- <param prefix="/bin/sh" suffix="" ignoreError="true"/> <!--prefix /opt/tongbu/mmm.sh suffix-->
- <filter start="false">
- <include expression="(.*)\.php"/>
- <include expression="(.*)\.sh"/>
- </filter>
- </plugin>
- <plugin name="socket">
- <localpath watch="/opt/tongbu">
- <deshost ip="192.168.138.20" port=""/>
- </localpath>
- </plugin>
- <plugin name="refreshCDN">
- <localpath watch="/data0/htdocs/cms.xoyo.com/site/">
- <cdninfo domainname="ccms.chinacache.com" port="" username="xxxx" passwd="xxxx"/>
- <sendurl base="http://pic.xoyo.com/cms"/>
- <regexurl regex="false" match="cms.xoyo.com/site([/a-zA-Z0-9]*).xoyo.com/images"/>
- </localpath>
- </plugin>
- </head>
启动服务程序
- [root@nfs01 sersync]# chmod +x /usr/local/sersync/bin/sersync 添加执行权限
- [root@nfs01 sersync]# vim /etc/profile
- export PATH="$PATH:/usr/local/sersync/bin/" #/etc/profile 最下面添加全局环境变量
- [root@nfs01 sersync]# sersync -dro /usr/local/sersync/conf/confxml.xml
命令执行结果
- root@web01 ~]# sersync -dro /usr/local/sersync/conf/confxml.xml
- set the system param
- execute:echo > /proc/sys/fs/inotify/max_user_watches
- execute:echo > /proc/sys/fs/inotify/max_queued_events
- parse the command param
- option: -d run as a daemon
- option: -r rsync all the local files to the remote servers before the sersync work
- option: -o config xml name: /usr/local/sersync/conf/confxml.xml
- daemon thread num:
- parse xml config file
- host ip : localhost host port:
- daemon start,sersync run behind the console
- use rsync password-file :
- user is rsync_backup
- passwordfile is /etc/rsync.password
- config xml parse success
- please set /etc/rsyncd.conf max connections= Manually
- sersync working thread = (primary thread) + (fail retry thread) + (daemon sub threads)
- Max threads numbers is: = (Thread pool nums) + (Sub threads)
- please according your cpu ,use -n param to adjust the cpu rate
- ------------------------------------------
- rsync the directory recursivly to the remote servers once
- working please wait...
- execute command: cd /backup && rsync -az -R --delete ./ rsync_backup@172.16.1.41::backup --password-file=/etc/rsync.password >/dev/null >&
- run the sersync:
- watch path is: /backup
二进制sersync部署安装的更多相关文章
- MariaDB二进制包简单安装部署
一.简介: MySQL最早是由Michael Widenius在所研发,而在后来Michael先生以10亿美元的价格把MySQL卖给了SUN以后不久SUN就被Oracle公司给收购了,在Oracle收 ...
- Kubernetes全栈架构师(二进制高可用安装k8s集群部署篇)--学习笔记
目录 二进制高可用基本配置 二进制系统和内核升级 二进制基本组件安装 二进制生成证书详解 二进制高可用及etcd配置 二进制K8s组件配置 二进制使用Bootstrapping自动颁发证书 二进制No ...
- Docker+Redis镜像的原理以及部署安装(超详解附截图)
文章来源:公众号-智能化IT系统. 一. DOCKER介绍 Docker简介 (1)Docker 是一个开源的应用容器引擎,基于 Go 语言,并遵从Apache2.0协议开源. (2)Docker 可 ...
- Elastic Stack之ElasticSearch分布式集群二进制方式部署
Elastic Stack之ElasticSearch分布式集群二进制方式部署 作者:尹正杰 版权声明:原创作品,谢绝转载!否则将追究法律责任. 想必大家都知道ELK其实就是Elasticsearc ...
- Apache Ignite 学习笔记(一): Ignite介绍、部署安装和REST/SQL客户端使用
Apache Ignite 介绍 Ignite是什么呢?先引用一段官网关于Ignite的描述: Ignite is memory-centric distributed database, cachi ...
- sersync部署
rsync : wget http://rsync.samba.org/ftp/rsync/src/rsync-3.1.1.tar.gz Sersync: wget https://raw.git ...
- 二进制包部署Kubernetes集群
今天这篇文章教给大家如何快速部署一套Kubernetes集群.K8S集群部署有几种方式:kubeadm.minikube和二进制包.前两者属于自动部署,简化部署操作,我们这里强烈推荐初学者使用二进制包 ...
- 二进制方法-部署k8s集群部署1.18版本
二进制方法-部署k8s集群部署1.18版本 1. 前置知识点 1.1 生产环境可部署kubernetes集群的两种方式 目前生产部署Kubernetes集群主要有两种方式 kuberadm Kubea ...
- Kubernetes全栈架构师(二进制高可用安装k8s集群扩展篇)--学习笔记
目录 二进制Metrics&Dashboard安装 二进制高可用集群可用性验证 生产环境k8s集群关键性配置 Bootstrapping: Kubelet启动过程 Bootstrapping: ...
随机推荐
- Maven中的dependency详解
<dependency> <groupId>junit</groupId> <artifactId>junit</artifactId> & ...
- 1. JDK 、 JRE 、JVM有什么区别和联系?
首先,我们分别对这三者进行阐述. JVM :英文名称(Java Virtual Machine),就是我们耳熟能详的 Java 虚拟机.它只认识 xxx.class 这种类型的文件,它能够将 clas ...
- VBA通过C#以API方式调用JS脚本函数
http://www.cnblogs.com/Charltsing/p/JSDotNetAPI.html 在网页采集中,很多时候需要运行网站下载的某个js文件中的函数,以计算Request参数.VBA ...
- flask环境布署--废弃不用,只留作备份
[前置条件] 创建1个flask-demo,生成requirement.txt文件(下载好gunicorn),上传至git.创建demo参照:创建一个flask api-demo(响应体显示中文) g ...
- 在VSCode中开启ESLint风格审查
最近一直在学习开发一个VUE项目,几乎没有前端基础摸爬滚打,就一边摸索HTML,JS,CSS一边模仿着已有代码开发,也还算能学到东西. VSCode确实还不错,很轻量.在刚开始学写vue的时候,后台总 ...
- jmeter的cookie跨线程传递
测试计划需要设置成独立运行每个线程组获取cookie需要先执行才能使接下来的cookie使用正确执行 登录线程组登录,使用正则表达式提取器提取所需cookie然后使用BeanShellPostProc ...
- 【MM系列】SAP MB5B中FI凭证摘要是激活的/结果可能不正确 的错误
公众号:SAP Technical 本文作者:matinal 原文出处:http://www.cnblogs.com/SAPmatinal/ 原文链接:[MM系列]SAP MB5B中FI凭证摘要是激活 ...
- 递归算法之排列组合-求一个集合S的m个元素的组合和所有可能的组合情况
求一个集合S的m个元素组合的所有情况,并打印出来,非常适合采用递归的思路进行求解.因为集合的公式,本身就是递归推导的: C(n,m) = C(n-1,m-1) + C(n-1,m). 根据该公式,每次 ...
- 【Go语言】map在goroutine通信中的使用问题
简介 本篇文章的主要内容是解决go语言map在使用中遇到的两个问题,对于初学者是不可避免的坑 一.cannot assign to struct field 当map中存在struct类型的成员,如果 ...
- docker--docker 的web可视化管理工具
12 docker 的web可视化管理工具 12.1 常用工具介绍 当 Docker 部署规模逐步变大后,可视化监控容器环境的性能和健康状态将会变得越来越 重要. Docker的图形化管理工具,提供状 ...