1. Environmental introduction
  1. System Kernel : 2.6.-642.4..el6.x86_64
  2. Source Server : 192.168.7.1
  3. Target Server : 192.168.7.10
  1. Target Server Configure
  1. 1Close SElinux
  1. sed -i "s/SELINUX=enforcing/SELINUX=disabled/g" /etc/selinux/config
  2. setenforce
  1. 2configure iptables server
  1. iptables -A INPUT -p tcp --dport -j ACCEPT
  2. iptables -A OUTPUT -p tcp --sport -j ACCEPT
  3. /etc/init.d/iptables save
  4. /etc/init.d/iptables restart
  1. 3Install Rsync server software
  1. yum -y install rsync xinetd
  2. sed -n s/"disable.*= yes"/"disable = no"/p /etc/xinetd.d/rsync
  3. sed -n 's/server_args.* = --daemon/server_args = --daemon --config=\/etc\/rsyncd.conf/p' /etc/xinetd.d/rsync
  4. /etc/init.d/xinetd start
  1. 4Create rsync configuration file and configure
  1. touch /etc/rsyncd.conf
  2. cat >> /etc/rsyncd.conf << END
  3. log file = /var/log/rsyncd/rsyncd.log
  4. pidfile = /var/run/rsyncd.pid
  5. lock file = /var/run/rsync.lock
  6. secrets file = /etc/rsync.pass
  7. motd file = /etc/rsyncd.Motd
  8. [vick1]
  9. path = /home/vick1
  10. comment = vick1
  11. uid = root
  12. pid = root
  13. port
  14. use chroot = no
  15. read only = no
  16. list = no
  17. max connections =
  18. timeout =
  19. auth users = vick
  20. hosts allow = 192.168.7.1
  21. END
  1. 5Create user authentication file
  1. touch /etc/rsync.pass
  2. echo "vick:123456" >> /etc/rsync.pass
  1. 6Set files permissions
  1. chmod /etc/rsync.pass
  2. chmod /etc/rsyncd.conf
  1. 7start-up rsync
  1. /etc/init.d/xinetd start
  1. Source server rsync client configure
  1. 1Close SElinux
  1.  
  1. sed -i "s/SELINUX=enforcing/SELINUX=disabled/g" /etc/selinux/config
  2. setenforce 0
  1.  
  1. 2configure iptables server
  1. iptables -A INPUT -p tcp --dport -j ACCEPT
  2. iptables -A OUTPUT -p tcp --sport -j ACCEPT
  3. /etc/init.d/iptables save
  4. /etc/init.d/iptables restart
  1.  
  1. 3Install Rsync server software
  1. yum -y install rsync xinetd
  2. sed -n s/"disable.*= yes"/"disable = no"/p /etc/xinetd.d/rsync
  3. /etc/init.d/xinetd start
  1. 4create password file
  1. touch /etc/sync.pass
  2. echo "" >> /etc/sync.pass
  3. chmod /etc/sync.pass
  1. 5Test single point synchronization
  1. rsync -avH --port=873 --progress --delete /home/vick1/ vick@192.168.7.10::vick1 --password-file=/etc/sync.pass
  1. Install sersync tools real time trigger Rsync synchronization
    1Check whether the server kernel supports inotify
  1. -rw-r--r-- 1 root root 0 May 2 14:33 max_queued_events
  2. -rw-r--r-- 1 root root 0 May 2 14:33 max_user_instances
  3. -rw-r--r-- 1 root root 0 May 2 14:33 max_user_watches

Notes: Make a list of three documents that show the kernel supports inotify

  1. 2 Modify kernel parameters
  1. cat >> /etc/sysctl.conf << END
  2. fs.inotify.max_queued_events=
  3. fs.inotify.max_user_watches=
  4. fs.inotify.max_user_instances=
  5. END
  1. sysctl -p
  1. Notes:
    Max_queued_events:inotify queue maximum length, if the value is too small, there will be * * * Event Overflow * * error,
    resulting in inaccurate monitoring files Queue
    max_user_watchesThe number of files to synchronizecan use find /home/vick1 -type d|wc -l statistics,
    must ensure that the max_user_watches value is greater than the statistical results
    max_user_instances:Create maximum value of inotify instance for each user
  1.  3Install and configure sersync services
  1. Download sersync software
  2. wget https://storage.googleapis.com/google-code-archive-downloads/v2/code.google.com/sersync/sersync2.5.4_64bit_binary_stable_final.tar.gz --no-check-certificate
  3. tar -zxvf sersync2..4_64bit_binary_stable_final.tar.gz
  4. mv GNU-Linux-x86 /usr/local/sersync

  Configure sersync services

Configure an instance and specify a synchronization directory,user and password

  1. cp /usr/local/sersync/confxml.xml /usr/local/sersync/confxml.xml.bak
    vim /usr/local/sersync/confxml.xml
  2.  
  3. <?xml version="1.0" encoding="ISO-8859-1"?>
  4. <head version="2.5">
  5. <host hostip="localhost" port=""></host>
  6. <debug start="false"/>
  7. <fileSystem xfs="false"/>
  8. <filter start="false">
  9. <exclude expression="(.*)\.svn"></exclude>
  10. <exclude expression="(.*)\.gz"></exclude>
  11. <exclude expression="^info/*"></exclude>
  12. <exclude expression="^static/*"></exclude>
  13. </filter>
  14. <inotify>
  15. <delete start="true"/>
  16. <createFolder start="true"/>
  17. <createFile start="false"/>
  18. <closeWrite start="true"/>
  19. <moveFrom start="true"/>
  20. <moveTo start="true"/>
  21. <attrib start="false"/>
  22. <modify start="false"/>
  23. </inotify>
  24.  
  25. <sersync>
  26. <localpath watch="/home/vick1">
  27. <remote ip="192.168.7.10" name="vick1"/>
  28. <!--<remote ip="192.168.8.39" name="tongbu"/>-->
  29. <!--<remote ip="192.168.8.40" name="tongbu"/>-->
  30. </localpath>
  31. <rsync>
  32. <commonParams params="-artuz"/>
  33. <auth start="true" users="vick" passwordfile="/etc/sync.pass"/>
  34. <userDefinedPort start="false" port=""/><!-- port= -->
  35. <timeout start="true" time=""/><!-- timeout= -->
  36. <ssh start="false"/>
  37. </rsync>
  38. <failLog path="/usr/local/sersync/logs/rsync_fail_log.sh" timeToExecute=""/><!--default every 60mins execute once-->
  39. <crontab start="false" schedule=""><!--600mins-->
  40. <crontabfilter start="false">
  41. <exclude expression="*.php"></exclude>
  42. <exclude expression="info/*"></exclude>
  43. </crontabfilter>
  44. </crontab>
  45. <plugin start="false" name="command"/>
  46. </sersync>
  47.  
  48. <plugin name="command">
  49. <param prefix="/bin/sh" suffix="" ignoreError="true"/> <!--prefix /opt/tongbu/mmm.sh suffix-->
  50. <filter start="false">
  51. <include expression="(.*)\.php"/>
  52. <include expression="(.*)\.sh"/>
  53. </filter>
  54. </plugin>
  55.  
  56. <plugin name="socket">
  57. <localpath watch="/opt/tongbu">
  58. <deshost ip="192.168.138.20" port=""/>
  59. </localpath>
  60. </plugin>
  61. <plugin name="refreshCDN">
  62. <localpath watch="/data0/htdocs/cms.xoyo.com/site/">
  63. <cdninfo domainname="ccms.chinacache.com" port="" username="xxxx" passwd="xxxx"/>
  64. <sendurl base="http://pic.xoyo.com/cms"/>
  65. <regexurl regex="false" match="cms.xoyo.com/site([/a-zA-Z0-9]*).xoyo.com/images"/>
  66. </localpath>
  67. </plugin>
  68. </head>
  69.  
  70. /usr/local/sersync/sersync2 -d -r -o  /usr/local/sersync/confxml.xml

  The final test is successful synchronization,The configuration is over here

  1. Extand
    Add script to monitor whether sersync is running properly
  1. touch /home/script/chech_sersync.sh
  2.  
  3. cat >> /home/script/chech_sersync.sh << END
  4. #!/bin/sh
  5.  
  6. sersync="/usr/local/sersync/sersync2"
  7.  
  8. confxml="/usr/local/sersync/confxml.xml"
  9.  
  10. status=$(ps aux |grep 'sersync2'|grep -v 'grep'|wc -l)
  11.  
  12. if [ $status -eq ];
  13.  
  14. then
  15.  
  16. $sersync -d -r -o $confxml &
  17.  
  18. else
  19.  
  20. exit ;
  21.  
  22. fi
  23. END
  1.  
  1.  
  1.  
  1.  
  1.  
  1.  
  1.  
  1.  
  1.  

rsync+sersync的更多相关文章

  1. Linux下Rsync+sersync实现数据实时同步

    inotify 的同步备份机制有着缺点,于是看了sersync同步,弥补了rsync的缺点.以下转自:http://www.osyunwei.com/archives/7447.html 前言: 一. ...

  2. rsync+sersync实现文件实时同步

    前言: 一.为什么要用Rsync+sersync架构? 1.sersync是基于Inotify开发的,类似于Inotify-tools的工具 2.sersync可以记录下被监听目录中发生变化的(包括增 ...

  3. Rsync+sersync文件实时同步

    一.为什么要用Rsync+sersync架构1.sersync是基于Inotify开发的,类似于Inotify-tools的工具2.sersync可以记录下被监听目录中发生变化的(包括增加.删除.修改 ...

  4. rsync+sersync实现数据文件实时同步

    一.简介 sersync是基于Inotify开发的,类似于Inotify-tools的工具: sersync可以记录下被监听目录中发生变化的(包括增加.删除.修改)具体某一个文件或某一个目录的名字: ...

  5. 如何通过rsync+sersync 实现同步备份

    3.rsync+sersync更快更节约资源实现web数据同步4.unison+inotify实现web数据双向同步 一:为什么要实现同步备份 服务器上有些重要文件或数据时,可以把他们多备份一份到其他 ...

  6. Rsync + sersync 实时同步备份

    一      Rsync + Sersync  实时同步介绍 1.Rsync 服务搭建介绍 云机上搭建Rsync server,在本地搭建Rsync Clinet. 2. Sersync 服务搭建介绍 ...

  7. rsync+sersync实现代码同步

    APP02安装 rsync服务端 yum install rsync vim /etc/rsyncd.conf pid file=/var/rsynclog/rsyncd.pid log file=/ ...

  8. Rsync + Sersync 实现数据增量同步

    部分引用自:https://blog.csdn.net/tmchongye/article/details/68956808 一.什么是Rsync? Rsync(Remote Synchronize) ...

  9. rsync+sersync+inotify实现服务器间文件同步之一

    rsync+sersync+inotify实现服务器间文件同步之一:rsync安装配置 2013年12月14日 ⁄ Linux管理, 服务器集群技术 ⁄ 共 4925字 ⁄ rsync+sersync ...

  10. Rsync+sersync实现数据实时同步

    前言: 一.为什么要用Rsync+sersync架构? 1.sersync是基于Inotify开发的,类似于Inotify-tools的工具 2.sersync可以记录下被监听目录中发生变化的(包括增 ...

随机推荐

  1. scala中ArrayBuffer简单使用

    import scala.collection.mutable.ArrayBuffer /** * 与Array区别: * 1.Array是不可变的,不能直接地对其元素进行删除操作,只能通过重赋值或过 ...

  2. php 垃圾回收机制 转载

    PHP的基本GC概念PHP语言同其他语言一样,具有垃圾回收机制.那么今天我们要为大家讲解的内容就是关于PHP垃圾回收机制的相关问题.希望对大家有所帮助.PHP strtotime应用经验之谈PHP m ...

  3. 期望dp——zoj3640

    /* dp[i]表示力量为i时的期望 dp[i]=sum{tj}/n+sum{dp[i+cj]+1}/n //前一项是cj<i的和,后一项是cj>=i的和 初始状态dp[m] */ #in ...

  4. Kibana启动报错 server is not ready yet的解决方案

    前言: ​ 今天在搭建elasticsearch集群的时候,再次使用Kibana操作elasticsearch的时候报告Kibana server is not ready yet的问题, ​ 通过在 ...

  5. AFO成功

    在dcoi一年多,还是发生了不少事情. 过程中也有些小遗憾,有做错的事情,有搞砸的事情,有没办法挽回的事情,这种没法读档的辣鸡游戏也是无可奈何的.对所有被我搞砸的事情说声对不起啦,至少在下一次的时候, ...

  6. 控制变量行业年份回归时在STATA里怎么操作_stata 分年份回归

    控制变量行业年份回归时在STATA里怎么操作_stata 分年份回归 我希望做一个多元回归,但需要控制年份和行业. (1)年份有7年2006-2012,听说STATA可以自动设置虚拟变量,请问命令是怎 ...

  7. spring boot中使用javax.validation以及org.hibernate.validator校验入参

    这里springboot用的版本是:<version>2.1.1.RELEASE</version> 自带了hibernate.validator,所以不用添加额外依赖 1.创 ...

  8. spring mvc文件上传报错:Expected MultipartHttpServletRequest: is a MultipartResolver configured?

    报错原因:spring-mvc.xml 的配置文件中,配置文件上传id不为 “multipartResolver” 解决:id 改为 “multipartResolver”

  9. iOS开发系列-文件下载

    小文件下载 NSURLConnection下载小文件 #import "ViewController.h" @interface ViewController ()<NSUR ...

  10. Shuffle过程详解