Installation and configuration of the CentOS 6.5 rsync service

Source: Internet
Author: User
Tags rsync

I. Introduction of RSYNC

rsync (remote synchronize) is a data synchronization tool that allows you to quickly sync files between multiple hosts via Lan/wan, or use rsync to synchronize different directories on your local hard drive.

Rsync is a tool for replacing RCP, which uses the so-called "rsync algorithm" to synchronize files between local and remote two hosts, which transmits only the different parts of two files, rather than the entire transfer every time, so it is quite fast. You can refer to how Rsync works A Practical Overview Learn more about the workings of rsync.

Rsync supports most Unix-like systems, which are well tested on Linux, Solaris, and BSD. In addition, it also has the corresponding version under the Windows platform, the more well-known have cwrsync and Sync2nas.

The initial author of Rsync is Andrew Tridgell and Paul Mackerras, which is currently maintained by Http://rsync.samba.org.

The basic features of rsync are as follows:

1. Can be mirrored to save the entire directory tree and file system;

2. It is easy to maintain the original file permissions, time, soft and hard links, etc.;

3. Can be installed without special permission;

4. Optimized process, high efficiency of file transfer;

5. You can use RCP, ssh and other means to transfer files, of course, you can also through a direct socket connection;

6. Anonymous transmission is supported to facilitate site mirroring.

There are two ways to use rsync for remote synchronization: remote Shell mode (SSH is recommended, user authentication is handled by SSH) and C/s (i.e. the client connects to a remote rsync server, and user authentication is the responsibility of the Rsync server).

Whether the data is synchronized locally or remotely, the first run will copy all the files once, and then the runtime will copy only the changed files (for new files) or changes to the file (for the original file).

Rsync does not have a speed advantage when it is first copied, and it is not as fast as tar, so when the amount of data is large you might consider first copying with tar before using rsync for data synchronization.


Common parameters for rsync production


Parameters Description Default Value
Exclude Specify multiple files or directories separated by spaces (relative paths) and add them to the exclude list. This is equivalent to using –exclude in the client command to specify the pattern. Empty
Exclude from Specifies a file name that contains the exclude rule definition from which the server reads the Exclude list definition. Empty
Include Specify multiple files or directories separated by spaces (relative paths) and add them to the include list. This is equivalent to using –include in the client command to specify the pattern. Empty
Include from Specifies a file name that contains the include rule definition from which the server reads the Include list definition. Empty


with the daemon (socket) the way data is transferred (This is An important function of rsync itself)

Second, rsync server application case


A, rsync Server Deployment

1. Installation of two ways

(1), Yum install-y rsync # # #在线安装rsync (2), wget http://pkgs.repoforge.org/rsync/rsync-3.0.9-2.el6.rfx.x8 6_64.rpm RPM-IVH rsync-3.0.9-2.el6.rfx.x86_64.rpm # # #下载rsync软件包之后rpm安装



2. See if the installation was successful

[[email protected] data]# Rpm-qa rsync # # #查看是否安装成功 rsync-3.0.6-12.el6.x86_64


3. Create the rsync master configuration rsyncd.conf file

[[email protected] data]# vi /etc/rsyncd.conf  #rsync_config___________start #created  by donglq 16:01 2016-12-09# #rsyncd. conf start# #uid  = nobodygid =  nobodyuse chroot = no    max connections = 200timeout  = 300pid file = /var/run/rsyncd.pidlock file = /var/run/rsync.locklog  file = /var/log/rsyncd.log[donglq]path = /donglq/ignore errorsread only  = falselist = falsehosts allow = 192.168.0.0/24hosts deny =  0.0.0.0/32auth users = rsync_backupsecrets file = /etc/rsync.password[data ]path = /data/gnore errorsread only = falselist = falsehosts  Allow = 192.168.0.0/24hosts deny = 0.0.0.0/32auth users = rsync_ backupsecrets file = /etc/rsync_data.password# #rsyncd. Conf___________end 

4. Create an rsync virtual user password file

echo "rsync_backup:123456" >/etc/rsync.password chmod 600/etc/rsync.password echo "rsync_backup:123456" &G T;/etc/rsync_data.passwordchmod 600/etc/rsync_data.password

5. Create a shared folder and modify its user group to nobody

[[Email protected] data]mkdir/donglq[[email protected] data]mkdir/data[[email protected] Data]chmod 600/donglq/data[[ Email protected] Data]chown NOBODY.NOBODY/DATA/DONGLQ

6.rsync--daemon # # #daemon模式启动rsync

[[email protected] data]# netstat -lntup|grep 873       # # #查看rsync是否启动tcp         0      0  0.0.0.0:873                  0.0.0.0:*                    LISTEN      1380/rsync           tcp        0       0 :::873                       :::*                          LISTEN       1380/rsync 


B. rsync Client Deployment

1. Installation

Yum install-y rsync # # #在线安装rsync


2. See if the installation was successful

Netstat-lntup|grep 873


3. Create a password file

echo "123456" >/etc/rsync.password4chmod 600/etc/rsync.password echo "123456" >/etc/rsync_data.passwordchmod 600/etc/rsync_data.password


C, rsync debugging

[Email protected] ~]# Rsync-avz [email protected]::d onglq/data/--password-file=/etc/rsync.password Receiving Incremental file list./11023456789.ice-unix/sent 261 bytes received 570 bytes 1662.00 bytes/sectotal size is 0 speedup is 0.00[[email protected] data]# Rsync-avz [email protected]::d ata/data/--password-file=/etc/rsync_data.password rece iving Incremental file list./1.txt/1/sent Bytes received 156 bytes 458.00 bytes/sectotal size is 0 speedup is 0.00


Configuration complete


Precautions:

During the entire installation process, the parameters can be copied as far as possible do not lose hand, to prevent errors. The password file and Module folder permissions should be set properly.

Careful and careful, there is no problem.


Reference:

http://blog.csdn.net/wjciayf/article/details/51812369

Installation and configuration of the CentOS 6.5 rsync service

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.