CentOS 6.5 Inotify+rsync Do real-time synchronization-Enterprise Instance (1.0)

Source: Internet
Author: User
Tags inotify rsync

Inotify+rsync real-time synchronization origin and introduction


INotify Service mechanism


INotify Implementation Preparation

The INotify configuration is based on the rsync service

Inotify,sersync,lsyncd

Sersync function More, can do a variety of filtering, but from a performance perspective, through the test results inotify higher performance, can sync good hundreds of images per second, inotify 150 can not be real-time


Check rsync daemon before implementation is normal

[[email protected] oldboy]# ps-ef |grep daemonroot 1261 1 0 Dec11? 00:00:04/usr/bin/rsync--daemonroot 13942 1945 0 02:57 pts/0 00:00:00 grep daemon

And can be pushed normally

[Email protected] scripts]# rsync-avz/data/[email protected]::d ATA--password-file=/etc/rsync.password Sending Incremental file list./1010011sent 4345 Bytes received 1893 bytes 4158.67 bytes/sectotal size is 0 speedup is 0.00


Work scenario


Installation of INotify


inotifywait Command Common parameters


inotify.sh Script Configuration Parameters

[[email protected] data]# cat/server/scripts/inotify1.sh#!/bin/bash#parahost01= 192.168.129.128src=/datadst=oldboyuser=rsync_backuprsync_passfile=/etc/rsync.passwordinotify_home=/usr/local/   #judge #if [ ! -e "$SRC"] #| |  [ ! -e  "${rsync_passfile}"  ] #| |  [ ! -e  "${inotify_home}/bin/inotifywait"  ] #| |  [ ! -e "/usr/bin/rsync"  ] ; #then #  echo  "Check file and  folder "#  exit 9#fi ${inotify_home}/bin/inotifywait -mrq --timefmt '%d/%m/% Y %h:%m '  --format  '%t %w%f '  -e close_write,delete,create,attrib  $src  |  while read file   #读前一段代码输出的   Documents          do         #rsync-avzp --delete --timeout=100 -- password-file=${rsync_passfile}  $src [email protected] $hostIn:: $dst  >/dev/null 2>&1         cd  $SRC && rsync -aruz -r --delete ./--timeout=100 [email protected] $host 01 :: $dst--password-file=${rsync_passfile}>/dev/null 2>&1         doneexit 0



























CentOS 6.5 Inotify+rsync Do real-time synchronization-Enterprise Instance (1.0)

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.