概述

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部署安装的更多相关文章

  1. MariaDB二进制包简单安装部署

    一.简介: MySQL最早是由Michael Widenius在所研发,而在后来Michael先生以10亿美元的价格把MySQL卖给了SUN以后不久SUN就被Oracle公司给收购了,在Oracle收 ...

  2. Kubernetes全栈架构师(二进制高可用安装k8s集群部署篇)--学习笔记

    目录 二进制高可用基本配置 二进制系统和内核升级 二进制基本组件安装 二进制生成证书详解 二进制高可用及etcd配置 二进制K8s组件配置 二进制使用Bootstrapping自动颁发证书 二进制No ...

  3. Docker+Redis镜像的原理以及部署安装(超详解附截图)

    文章来源:公众号-智能化IT系统. 一. DOCKER介绍 Docker简介 (1)Docker 是一个开源的应用容器引擎,基于 Go 语言,并遵从Apache2.0协议开源. (2)Docker 可 ...

  4. Elastic Stack之ElasticSearch分布式集群二进制方式部署

    Elastic Stack之ElasticSearch分布式集群二进制方式部署 作者:尹正杰  版权声明:原创作品,谢绝转载!否则将追究法律责任. 想必大家都知道ELK其实就是Elasticsearc ...

  5. Apache Ignite 学习笔记(一): Ignite介绍、部署安装和REST/SQL客户端使用

    Apache Ignite 介绍 Ignite是什么呢?先引用一段官网关于Ignite的描述: Ignite is memory-centric distributed database, cachi ...

  6. sersync部署

    rsync :  wget  http://rsync.samba.org/ftp/rsync/src/rsync-3.1.1.tar.gz Sersync: wget https://raw.git ...

  7. 二进制包部署Kubernetes集群

    今天这篇文章教给大家如何快速部署一套Kubernetes集群.K8S集群部署有几种方式:kubeadm.minikube和二进制包.前两者属于自动部署,简化部署操作,我们这里强烈推荐初学者使用二进制包 ...

  8. 二进制方法-部署k8s集群部署1.18版本

    二进制方法-部署k8s集群部署1.18版本 1. 前置知识点 1.1 生产环境可部署kubernetes集群的两种方式 目前生产部署Kubernetes集群主要有两种方式 kuberadm Kubea ...

  9. Kubernetes全栈架构师(二进制高可用安装k8s集群扩展篇)--学习笔记

    目录 二进制Metrics&Dashboard安装 二进制高可用集群可用性验证 生产环境k8s集群关键性配置 Bootstrapping: Kubelet启动过程 Bootstrapping: ...

随机推荐

  1. Python的复制,浅拷贝和深拷贝

    https://www.cnblogs.com/xueli/p/4952063.html 如果给一个变量赋值一个对象,那么新变量和原对象变量将会是同一个引用,其中一方改变,另一方也会改变. 该问题可以 ...

  2. Xcode10报错 library not found for -lstdc++ 问题解决

    在Xcode9上正常编译的项目,在Xcode10上编译可能会遇到如下错误: library not found for -lstdc++.6.0.9 library not found for -ls ...

  3. 常量const实践

    这篇文章写的很好:https://www.cnblogs.com/zhangfeionline/p/5882790.html 自己是实践: 1. 定义时必须初始化值,不然如下错误: 2. 3. 使用:

  4. pwa 总结

    概述 前几天了解并按照官方文档,成功实现了一个小型的 pwa demo,现在把总结记录下来,供以后开发时参考,相信对其他人也有用. pwa pwa 包括很多内容,我这里只介绍一部分,因为比如 Push ...

  5. Linux_SystemLogManager

    目录 目录 前言 日志管理journalctl工具 日志服务属性 自定义日志 journalctl 指令 前言 还是RHEL7的新特性,引入了journalctl指令作为系统日志的管理工具. 日志管理 ...

  6. 简要介绍一下MD5加密的书写

    大家应该多清楚数据的重要性,可以假设一下:一个非常大的企业,因为一个程序员的疏忽大意,没有使用MD5加密,那么可以说这个企业的数据库是非常不安全的,可以轻而易举的的访问你的数据库,并执行任何操作. 下 ...

  7. 阶段3 1.Mybatis_11.Mybatis的缓存_2 延迟加载和立即加载的概念

    用户关联的account信息,假设一个用户管理的account有100个.那么我们在查询用户的时候那100个关联的信息也被查询出来. 用的时候才去查关联的数据 这两个不同的地方就是查询的时机不同 什么 ...

  8. windows 使用Docker Desktop 使用国内镜像

    ===新增一些比较给力的镜像=== 1.中科大镜像加速地址 https://docker.mirrors.ustc.edu.cn 2.阿里云镜像服务 ========= 原本在配置项中添加了:国内镜像 ...

  9. 将Unix时间戳转换为Date、Json属性动态生成反序列化、序列化指定属性

    实体类 public class Test { [JsonIgnore] public string GetDate { get { return GetTime.ToString("yyy ...

  10. Django-DRF组件学习-预备知识

    1.web开发应用模式 在开发Web应用中,有两种应用模式: 1.1 前后端不分离 所谓的前后端不分离,就是前后端数据都在同一个服务器中,前端的样式以及页面渲染都由后端一次性渲染出来在前端浏览器中展示 ...