Real-time data synchronization

First, why use rsync + sersync architecture?

1, sersync is based on inotify development, inotify-tools similar tools

2, sersync can record a file or directory is changed to listen directory (add, delete, modify) the specific name of a file or a directory, and then use rsync to synchronize the time, only sync changes

Two, rsync + difference inotify-tools and rsync + sersync architecture?

. 1, the rsync the inotify-Tools +
A, the inotify directory is recorded only at listener changes (add, delete, change) which is not the particular file or which directory record change;
B, in synchronization the rsync time, does not know which specific file or directory changes, each time the entire directory synchronization, when the amount of data is large, the entire directory synchronization is very time-consuming (rsync to traverse the entire directory to find reference documents), therefore inefficient

2, the rsync sersync +
A, sersync can record changes in the monitored directory (add, delete, change) the specific name of a file or directory;
B, when synchronizing the rsync, synchronize only changed files or directories (per data times changed relatively little for the entire data directory synchronization, rsync when traversing find the comparison document, very fast), so efficiency is very high.

The synchronization process:

  1. Open the synchronization server sersync service, sersync responsible for monitoring file system events change configuration path; in fact sersync is to monitor local data write or update event, by rsync pushed to the target server.
  2. Call the rsync command to synchronize the updated files to the target server;
  3. Sersync need to configure the master server, configure the rsync server in sync target server (note: is rsync service)

    The synchronization process and principles:

  4. User real-time data is written to the update file on sersync server;
  5. Sersync need to configure synchronization services on the primary server;
  6. Open on another server rsync daemon service to synchronize pull data from the server on sersync;
    can be found via the rsync daemon service, in fact sersync is to monitor local data write or update event; then, the call rsync client file commands to write or update events corresponding to the target server via rsync push

Third, the operation
of a loaded sersync a service to install rsync 10.0.0.5 site's root / var / www / html directory backup to 10.0.0.6 of / www (so only the 10.0.0.6 install rsync on it.
Sersync server (source machine; a data source [deployment project, code, etc.]): 10.0.0.5
Rsync server (backup machine (backup large end disk designed to store data); target machine): 10.0.0.6

Guess you like

Origin blog.51cto.com/11676712/2481252