sersyn安装

一、       介绍

sersync主要用于服务器同步,web镜像等功能。基于boost1.43.0,inotifyapi,rsync command开发。目前使用的比较多的同步解决方案是inotify-tools+rsync ,另外一个是google开源项目Openduckbill(依赖于inotify- tools),这两个都是基于脚本语言编写的。相比较上面两个项目,本项目优点是:

1、  sersync是使用c++编写,而且对linux系统文件系统产生的临时文件和重复的文件操作进行过滤,所以在结合rsync同步的时候,节省了运行时耗和网络资源,因此更快

2、  使用多线程进行同步,尤其在同步较大文件时,能够保证多个服务器实时保持同步状态

3、  sersync有出错处理机制,通过失败队列对出错的文件重新同步,如果仍旧失败,则按设定时长对同步失败的文件重新同步

4、  有自带crontab功能,只需在xml配置文件中开启,即可按您的要求,隔一段时间整体同步一次

5、  Sersync支持socket与http插件扩展,可以满足其它需求

一.下载sersync源码包

# wget http://sersync.googlecode.com/files/sersync2.5_32bit_binary_stable_final.tar.gz

注:若在64位平台安装则可下载64位sersync源码包,本例用32位

# wget http://sersync.googlecode.com/files/sersync2.5_64bit_binary_stable_final.tar.gz

二.创建sersync目录结构

# mkdir /usr/local/sersync

# mkdir /usr/local/sersync/conf

# mkdir /usr/local/sersync/bin

# mkdir /usr/local/sersync/log

# tar zxvf sersync2.5_32bit_binary_stable_final.tar.gz

# cd GNU-Linux-x86/

# cp confxml.xml /usr/local/sersync/conf

# cp sersync2 /usr/local/sersync/bin

三.配置sersync

1.首先创建连接rsyncd的密码文件

# echo "123456" >/etc/rsync.pas

# chmod 600 /etc/rsync.pas

2.配置confxml.xml

# cd /usr/local/sersync/conf

# vi confxml.xml

按照注释进行修改

-----------------------------

<?xml version="1.0" encoding="ISO-8859-1"?>

<head version="2.5">

# 设置本地IP和端口

<host hostip="localhost" port="8008"></host>

# 开启DUBUG模式

<debug start="false"/>

# 开启xfs文件系统

<fileSystem xfs="false"/>

# 同步时忽略推送的文件(正则表达式),默认关闭

<filter start="false">

<exclude expression="(.*)\.svn"></exclude>

<exclude expression="(.*)\.gz"></exclude>

<exclude expression="^info/*"></exclude>

<exclude expression="^static/*"></exclude>

</filter>

<inotify>

# 设置要监控的事件

<delete start="true"/>

<createFolder start="true"/>

<createFile start="true"/>

<closeWrite start="true"/>

<moveFrom start="true"/>

<moveTo start="true"/>

<attrib start="true"/>

<modify start="true"/>

</inotify>

<sersync>

# 本地同步的目录路径

<localpath watch="/data">

# 远程IP和rsync模块名

<remote ip="192.168.100.29" name="data"/>

<!--<remote ip="192.168.8.39" name="tongbu"/>-->

<!--<remote ip="192.168.8.40" name="tongbu"/>-->

</localpath>

<rsync>

# rsync指令参数

<commonParams params="-auvzP"/>

# rsync同步认证

<auth start="true" users="user" passwordfile="/etc/rsync.pas"/>

# 设置rsync远程服务端口,远程非默认端口则需打开自定义

<userDefinedPort start="false" port="874"/><!-- port=874 -->

# 设置超时时间

<timeout start="true" time="100"/><!-- timeout=100 -->

# 设置rsync+ssh加密传输模式,默认关闭,开启需设置SSH加密证书

<ssh start="false"/>

</rsync>

# sersync传输失败日志脚本路径,每隔60会重新执行该脚本,执行完毕会自动清空。

<failLog path="/usr/local/sersync/log/rsync_fail_log.sh" timeToExecute="60"/><!--default every 60mins execute once-->

# 设置rsync+crontab定时传输,默认关闭

<crontab start="false" schedule="600"><!--600mins-->

<crontabfilter start="false">

<exclude expression="*.php"></exclude>

<exclude expression="info/*"></exclude>

</crontabfilter>

</crontab>

# 设置sersync传输后调用name指定的插件脚本,默认关闭

<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="8009"/>

</localpath>

</plugin>

<plugin name="refreshCDN">

<localpath watch="/data0/htdocs/cms.xoyo.com/site/">

<cdninfo domainname="ccms.chinacache.com" port="80" 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>

-----------------------------

3.创建推送端sersync同步目录

# mkdir /data

4.设置环境变量:

# echo "export PATH=$PATH:/usr/local/sersync/bin/" >> /etc/profile

# source /etc/profile

5.启动sersync

# sersync2 -r -d -o /usr/local/sersync/conf/confxml.xml

注:重启操作如下:

# killall sersync2 && sersync2 -r -d -o /usr/local/sersync/conf/confxml.xml

时间: 2025-01-11 11:23:47

sersyn安装的相关文章

安装Windows7系统时,提示:缺少所需的CD/DVD驱动器设备驱动程序

      测试机型:HP probook 430 g3       系统:Windows 7 Pro x64 现在笔记本电脑主板集成的USB口大多为3.0版本,而且一些厂商为了追求PC的轻薄,不再集成光驱,所以我们在安装系统时,一般只能通过U盘或U口外接光驱. 而当我们因为需要(安装OEM系统),在通过刻录软件(如UltraISO)将系统写入U盘或光盘的方式安装系统时,此时问题就可能悄悄出现了:因为Win7官方原版系统没有集成USB3.0驱动,所以可能的报错如下: 点击"浏览"或通过

Windows8.1-KB2999226-x64安装提示 此更新不适用你的计算机

如题 Windows8.1-KB2999226-x64.msu  双击安装 安装提示 此更新不适用你的计算机 . 解决方案: 放在D:\update\目录下 windows键+X  选择  命令提示符(管理员)  一定要是管理员 打开cmd 分别执行下面两句.红色部分就是自己的更新程序了.其他安装同理 例如Windows8.1-KB2919442-x64.msu 等 1    expand –F:* D:\update\Windows8.1-KB2999226-x64.msu D:\update

pip安装提示PermissionError: [WinError 5]错误问题解决

 问题现象 新安装python3.6版本后使用pip安装第三方模块失败,报错信息如下: C:\Users\linyfeng>pip install lxml Collecting lxml Downloading http://pypi.doubanio.com/packages/fb/41/b8d5c869d01fcb77c72d7d226a847a3946034ef19c244ac12920b71cd036/lxml-3.8.0-cp36-cp36m-win32.whl (2.9MB) 10

windows安装TortoiseGit详细使用教程【基础篇】

环境:win8.1 64bit 安装准备: 首先你得安装windows下的git msysgit1.9.5 安装版本控制器客户端tortoisegit  tortoisegit1.8.12.0 [32和64别下载错,不习惯英文的朋友,也可以下个语言包] 一.安装图解: 先安装GIT[一路默认即可] 安装好git以后,右键,会发现菜单多了几项关于GIT的选项 2.安装tortoisegit[一路默认即可] 安装好以后,右键,会发现菜单多了几项关于tortoisegit的选项 到此,安装算完成了,相

在Win10 Anaconda中安装Tensorflow

有需要的朋友可以参考一下 1.安装Anaconda 下载:https://www.continuum.io/downloads,我用的是Python 3.5 下载完以后,安装. 安装完以后,打开Anaconda Prompt,输入清华的仓库镜像,更新包更快: conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free/ conda config --set show_channel_url

Linux下WebSphereV8.5.5.0 安装详细过程

Linux下WebSphereV8.5.5.0 安装详细过程 自WAS8以后安装包不再区别OS,一份介质可以安装到多个平台.只针对Installation Manager 进行了操作系统的区分 ,Websphere产品介质必须通过专门的工具Install Managere安装.进入IBM的官网http://www.ibm.com/us/en/进行下载.在云盘http://yun.baidu.com/share/linkshareid=2515770728&uk=4252782771 中是Linu

Python学习1-Python和Pycharm的下载与安装

本文主要介绍Python的下载安装和Python编辑器Pycharm的下载与安装. 一.Python的下载与安装 1.下载 到Python官网上下载Python的安装文件,进入网站后显示如下图: 网速访问慢的话可直接在这里下载:python-2.7.11.amd64 在Downloads中有对应的支持的平台,这里我们是在Windows平台下运行,所以点击Windows,出现如下: 在这里显示了Python更新的所有版本,其中最上面两行分别是Python2.X和Python3.X对应的最后更新版本

oracle安装故障:完美解决xhost +报错: unable to open display “”

oracle安装 先切换到root用户,执行xhost + 然后再切换到oracle用户,执行export DISPLAY=:0.0 出现乱码执行export LANG=US_en 在这里给大家介绍下两种情况的常见问题: 一种是本地运行的命令,另一种则是远程ssh命令安装. DISPLAY科普 DISPLAY变量是用来设置将图形显示到何处.比如CENTOS,你用图形界面登录进去,DISPLAY自动设置为DISPLAY=:0.0表示显式到本地监视器,那么通过终端工具(例如:xshell)进去,运行

centos7下使用yum安装mysql

CentOS7的yum源中默认好像是没有mysql的.为了解决这个问题,我们要先下载mysql的repo源. 1. 下载mysql的repo源 $ wget http://repo.mysql.com/mysql-community-release-el7-5.noarch.rpm 2. 安装mysql-community-release-el7-5.noarch.rpm包 $ sudo rpm -ivh mysql-community-release-el7-5.noarch.rpm 安装这个