rsync implementation of File timing synchronization Techniques _ Server Other

Source: Internet
Author: User
Tags documentation ftp file permissions rsync

Use background:

May 2005, Business Network in the online stage. However, due to the overall reason has been slow to go online. System basic functions have been implemented, but as a business network as a whole, file synchronization is not completed. I am not very busy this time. I have some interest in this piece, so I decided to touch it.

The beginning of everything is difficult, never contacted what synchronization and so on, how to start? Fortunately before the mail system, know the Eyou bear, consulted him, and recommended the good rsync this tool to me. Here, especially thanks to Teddy Bear's help.
The advantage of Rsync is its ease of deployment, ease of use, high efficiency, and it is open source. Currently in some Linux server version has been bundled in, it can be seen that the function has been a high degree of recognition.

On the introduction of rsync, we can go to Google search, I believe we can find more, in this, I will no longer waste everyone's time (Mr. Lu Xun said: Wasting others time equals murder, wasting their time equals chronic suicide.) Know the seriousness of the consequences, hehe). Let's take a look at my implementation steps.

Operating system:

File server side: Red Hat Linux Advanced Server Release 2.1as/i686 (Pensacola)

Client: Red Hat Linux Release 7.2 (Enigma)

Among them, server-side Linux has been bundled with Rsync. I also implemented the client under AIX.

[Considerations]:

1, to determine whether the system itself has been bound (installed) rsync, you can go to/usr/bin,/usr/local/bin/or/usr/sbin/directory to find out whether rsync exists, or use Whereis rsync, also do.

2, the system has been bound to rsync, in the/etc/xinetd.d/rsync, the default is closed. You can turn it on and then restart service xinted restart

3, if the system itself has been installed, it does not need to be installed, if you need to upgrade the rsync version, just follow the normal installation steps installed.

4, rsync default binding is 873 ports, if Rsync has been started as a background process, then through Netstat–nap|grep 873 should be able to see the rsync process.

1. Install rsync

Step one: Download rsync packages from http://rsync.samba.org/(This article configures the use of Rsync 2.6.5 released)

Step two: Upload the rsync package to the machine that is the server (for example: 128.128.6.168)

Step three: Go to root login, unzip the rsync-2.6.5pre2.tar.gz package, go to the specified directory (for example:/home/zuohao/rsync/), and assign the Rsync directory to a user (for example: Zuohao).

Fourth step: Access to the Rsync directory. Type:./configure.

Rsync detects system information and generates related files.

Fifth step: Type make, compile C file. (Note: Determine whether to install the C compiler, such as GCC,CC, before running the command.) )
Sixth step: Type make install turn to rsync. (Note: Determine whether to install the C compiler, such as GCC,CC, before running the command.) )
Seventh step: If the above compilation is not a problem, rsync installation completed.

2, configure the Rsync service side

The main configuration file on the server side is/etc/rsyncd.conf (the file may not exist and you can create a new one yourself.) , which allows you to configure parameters for global access and module parameters that need to be backed up. Take the following configuration as an example:

Copy Code code as follows:

UID = root
GID = root
Use chroot = no
Max connections = 4
PID file =/var/run/rsyncd.pid
Lock file =/var/run/rsync.lock
Log file =/var/log/rsyncd.log
Hosts allow = 128.128.6.38
[Inburst]
Path =/usr/shr
Comment = BACKUP CLIENT is REDHAT ADVANCE SERVER 3.0
Read Only = yes
List = no
Auth users = root
Secrets file =/etc/inburst.pass
[FILE0]
Path =/home/zuohao/www
Comment = My rsync site
Exclude = ConfigFile

Rsyncd.conf can have more configuration, such as password verification, module settings, and so on.

[Considerations]

rsyncd.conf and password file permissions must be 600, that is, only root readable \ Write

For more rsyncd.conf properties please refer to. HTTP://RSYNC.SAMBA.ORG/FTP/RSYNC/RSYNCD conf.html

3. Configure Rsync Client

The first step: Install Rsync: To achieve synchronization on the client, also need to turn to rsync services, (installation method reference above).

Step Two: Test if the installation was successful.

At the command line, enter:

Copy Code code as follows:

RSYNC-VZRTOPG--progress--delete zuohao@128.128.6.38::file0/home/zuohao/backup/

Check to see if the local directory/home/zuohao/backup/is synchronized with the required backup directory files in the server.

For more parameter descriptions, refer to the Rsync Web site documentation:

Http://rsync.samba.org/ftp/rsync/preview/rsync.html

The third step: the preparation of a timer run shell, run the above command, to achieve the timing of the file synchronization.

By editing crontab, the corresponding script is added to realize the timing synchronization of the files. This example script is as follows:

*/30 * * * * zuohao/usr/local/bin/rsync.sh

Run once every 30 minutes.

4. Installation Complete

After the above configuration, rsync server-side and client configuration has been completed, simple file timing synchronization can be achieved basically. There are more examples and documents to http://rsync.samba.org/on the official website of Rsync. I hope you will be able to look at those documents after you have a great understanding of rsync, so that you can use rsync more fully.

Attention matters

1, in general, the Linux Server version has been installed rsync.

2. Be sure to determine if the system has the C compiler installed before you install rsync. Otherwise the installation cannot continue.

3, the installation of rsync must be root user.

4, rsyncd.conf file permissions must only root can read, write, namely chmod rsyncd.conf

5, if the use of password files, password file permissions can only be 600

6, a rsyncd.conf file can configure multiple backup modules, each module can be defined to allow access to the IP (hosts allow) address and inaccessible IP (hosts deny) specific reference to the Rsync site rsyncd.conf documentation.

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.