rsync + lsyncd file real time Sync/backup

Source: Internet
Author: User
Tags lua rsync

LSYNCD on which server to start, this server is like when the server is synchronized, other servers if more files will be deleted, fewer files will be synchronized from this server.

Modifying the contents of the file will also be synchronized

Rsync can achieve synchronization/backup of files, install configuration step to Linux under rsync Backup/Sync files

LSYNCD implementation of trigger or timed notification events, can be near real-time synchronization files (encapsulated rsync), GitHub address: HTTPS://GITHUB.COM/AXKIBE/LSYNCD


System: centos6.4

Home server: 192.168.1.136

Sync Server: 192.168.1.137


Install the LSYNCD on the 192.168.1.136

Installation Dependencies (Lsyncd written in the Lua language)

[plain] view plain copy print? Yum Install Lua Lua-devel

Download Lsyncd-master.zip on GitHub

[plain] view plain copy print? Unzip Lsyncd-master.zip CD Lsyncd-master CMAKE-DCMAKE_INSTALL_PREFIX=/USR/LOCAL/LSYNCD make && make instal L
Creating a configuration file

[plain] view plain copy print? Cd/usr/local/lsyncd/mkdir./etc mkdir./var VI etc/lsyncd.conf
The content is (--is the annotation character in Lua)

[Plain]  View plain  copy  print? --  Global configuration     settings {       --  log file storage location        logfile = "/usr/local/lsyncd/var/lsyncd.log",           --  Status file storage location        statusfile = "/usr/local/lsyncd/var/ Lsyncd.status ",          --  writes the LSYNCD state to the Statusfile interval above, default 10 seconds        --statusInterval = 10           --  whether to enable daemon mode, default  true       --nodaemon=true            -- inotify Monitored event &nbsp, default is  closewrite, can also be  Modify  or   closewrite or modify       inotifyMode =  "Closewrite",           --  max sync process        maxprocesses = 8,          --Cumulative to how many events are monitored to activate one synchronization, Even after the delay delay time has not yet been        --maxDelays = 1  }      --  Remote directory synchronization    sync {       -- rsync ,  rsyncssh , direct  Three models        default.rsync,           --  Sync source directory, using absolute path.        source =  "/home/wwwroot/attachments",          --  define the destination address. There are several ways to do this, using remote sync addresses, addresses in rsync         target =  "RSYNC137@192.168.1.137::RSYNCD",          --  Default  true , allowing synchronous deletion. There are  false, startup, running  values        --delete = true,           --  which files are different steps        exclude = {  ". *"  },          --  Cumulative events, waiting for rsync synchronization delay time, default 15 seconds, maximum cumulative to 1000 non-merged events (1000 file changes),       delay = 15,  

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.