rsync, rsync + ssh, rsync + LSYNCD multiple synchronization schemes and comparisons

Source: Internet
Author: User
Tags syslog

1. Using Ssh+rsync
You only need to open the SSH service on the server side and start the rsync service in xinetd to use
A. Incremental synchronization
rsync-av/src-dir/. [email protected]:/dest-dir/.
B. Mirroring synchronization
Rsync-av--delete/src-dir/. [email protected]:/dest-dir/.
Features: Simple configuration, no need to configure rsyncd.conf profile, but requires user authentication during synchronization
Note: You can create an auto-sync encryption script with Expact + Gzipexe
Use: can be synchronized manually or custom time tasks every night
Disadvantage: Unable to achieve real-time synchronization, can not become a dual-machine hot backup scheme?

2. Enable the Rsync service
Need to configure/etc/rsyncd.conf configuration file, need to start rsync service in xinetd, can not be coordinated by sshd
A. configuration file (refer to man 5 rsyncd.conf, directory sharing management reference smb.conf)

rsyncd.conf Reference
MOTD file = true # time record
PID file =/var/run/rsyncd.pid
Port = 873
Address = 0.0.0.0
Log file =/var/log/rsyncd.log # rsync standalone log that records update information for each file
Syslog facility = syslog # increased synchronization start and end information to/var/log/messages
UID = Nobody # Note: The rsync process user ID is defined when synchronizing
GID = Nobody
Use chroot = no

[Share]
Path=/tmp/test
Read Only=false

rsyncd.conf Configuring Security Information:
CharSet for setting character sets, available character set reference smb.conf standard
Max connections number of concurrent connections
Read only read-write control
Write only read/write control
Whether the list allows clients to use rsync--list-only rsync://192.168.1.11:873 to query shared directory information
Note: rsync--list-only rsync://192.168.1.11:873/share/. Ability to list file information, regardless of list parameter
Exclude ignoring a file or directory during synchronization ex: = new/old/kdump.conf (Note: Only relative path required)
Exclude from =/etc/rsyncd.list Ignore information for file record synchronization process
Incoming chmod file directory permission definitions
Outgoing chmod file directory permission definitions
Auth users with Secrets file use, define user authentication (clear text) = User1 User2 User3
Secrets file = FilePath Verify file Syntax User:password (must contain user123 above) files root 600 property
Hosts allow host IP definition
Hosts deny host IP definition
Log format default format%o%h [%a]%m (%u)%f%l reference rsyncd.conf

Common synchronization syntax
Rsync--list-only rsync://192.168.1.11:873/share/. Ability to list file information
Rsync--list-only rsync://192.168.1.11:873 Querying shared directory information
Rsync--exclude-from=file.txt rsync://192.168.1.11:873/share/. /tmp/test/. Specify information in a different step

Advantages: Avoid displaying the absolute path of the host file information, a variety of security settings, do not need to use SSH user authentication, support anonymous synchronization
Cons: Unable to proactively push files

3. RSYNC+LSYNCD Data Synchronization

[Rsync Server] <------[LSYNCD]---> [rsync server]

Rsync client needs to compile LSYNCD software, install Rsync tool
Rsync server needs to configure and start the rsync process, as in the example above, anonymous shared share directory

Download the latest version
Http://lsyncd.googlecode.com/files/lsyncd-2.0.5.tar.gz
Dependency: Lua >= 5.1.3, Rhel6 patch
ftp://ftp.pbone.net/mirror/ftp.scientificlinux.org/linux/scientific/6rolling/i386/os/Packages/ lua-devel-5.1.4-4.1.el6.i686.rpm

Syntax calls LUA format

Creating a configuration file Share.lua

Settings = {
.. Slightly
Nodaemon = True, # False becomes foreground process, easy to test
Statusinterval = 3, # lsyncd.status status update interval
... Slightly
}

sync{
.. Slightly
}

bash = {
... Slightly
}

Settings is the primary configuration, sync is synchronous, bash is the synchronization scheme

Start method
LSYNCD Share.lua

The initial start will automatically synchronize the contents of the file, after the file changes, add, delete will be automatically synchronized
If you need to synchronize multiple computers, you can use scripts such as LSYNCD Backup.lua to start the process multiple times

Advantages of the scheme:
1. Automatically push files in the directory to the Rsync server
2. Ability to support multiple rsync servers
3. Avoid human involvement in modification
Disadvantages:
Synchronization time is not real time, approximately 30 seconds delay
It is not recommended to use large files for synchronization


rsync, rsync + ssh, rsync + LSYNCD multiple synchronization schemes and comparisons

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.