Fast configuration of Rsync file backup service under CentOS

Source: Internet
Author: User
Tags rsync

Rsync Simple and quick configuration

Rsync enables full-scale and incremental local or remote data backup. One rsync is equivalent to SCP,CP,RM but better than each of them because rsync is such a useful piece of software that many Linux distributions are included.

Of course, you can also go to the official RYSNC official website: http://rsync.samba.org/Get the latest version from above.

Installation methods There are several types of yum install Rsync-y or from the Web site to the GZ package for compilation and installation.

1, rsync server file configuration.

Default His profile does not exist, so you need to manually create a configuration file

Touch/etc/rsyncd.conf

The contents of the file are as follows:

#rsync用客户端连接过来具备默认的用户权限设置

UID = rsync

GID = rsync

#跟程序安全相关默认设置个开启.

Use chroot = no

#设置客户端连接数.

Max Connections =2000

#超时时间 "The client Connection server kicked off the connection for more than 600 seconds.

Timeout = 600

#pid的文件, the PID is the process number.

PID file =/var/run/rsyncd.pid

Lock file =/var/run/rsyncd.lock

Log file =/var/log/rsyncd.log

#忽略错误

Ignore errors

#设置上来这块是否可正常读写, now read-only false so the result is readable and writable.

Read Only = False

#不让服务端列表.

List = False

#允许哪些ip可以.

Hosts allow = 192.0.0.0/24

#拒绝哪些IP

Hosts Deny = 0.0.0.0/32

#启用一个虚拟用户.

Auth users = Rsync_backup

#存放用户和密码的文件

Secrets file =/etc/rsync.password

###########################################

#共享一个文件目录 [Module]

[Backup]

#comtnt是注释

Comment = www by old0boy

#设置共享的路径.

Path =/backup

If you want to learn more about the parameters come to man rsyncd.conf to see.

2. Create user and backup directory

Useradd rsync-s/sbin/nologin-m:-s/sbin/nologin means to create this user but cannot log into the system with him

passwd rsync: Create a password for him

Mkdir/backup The backup directory is created, and the files to be backed up by other clients are placed in this directory
Chown-r rsync.rsync/backup Changing the permissions of a directory

3. Create a password file.

Corresponds to the Secrets file=/etc/rsync.password in the configuration file

Touch/etc/rsync.password then VI edit put the rsync password you set in.

or echo "rsync_backup:123456" in this way >/etc/rsync.password

Rsync is your user _backup is the module name you set in the configuration file. In the above (1) in the configuration file contents of the # Share a file directory under the "Backup" if "" in the name has changed, you need to change here, 123456 is the password you set.

Should be a password file so last set permissions

chmod 600/etc/rsync.password

4. Start Rsync Service

Rsync--deamon

Then add it to boot.

5. rsync Client Configuration operation

Only two things on the client are OK

1) Create a password file.

echo "123456" >/etc/rsync.password here only need to put your server rsync user password in the OK.

chmod 600/etc/rsync.password

2) Send the file.

6. The parameters commonly used on rsync clients.

Rsync client's common parameters (the specific parameters can be checked online. )

-v Verbose mode output, progress information during transfer

-Z Compression on transfer

-A represents all equivalent to RTOPGDL

-E Specify Channel

--exclude Exclude Files

--exclunde-from=file the directory where the file name resides.

--bwlimit speed limit

rsync-avz/tmp [email protected]::backup--password-file=/etc/rsync.password

(This inside [email protected]::backup:: Backup is your server back directory name)

Rsync configuration is complete!!! You can test the test after you have finished configuring it.

Other Notes for rsync:

Rsync Security Optimization

1) If you only want to transfer between the local area network later. First you can bind the address to an intranet address of the network card.

Rsync--daemon--address=192.168.0.221

2) If the cross-room in the internet transmission, 1, pull line. 2. Using VPN

Rsync pros and cons

Pros 1. Incremental backup sync and socket (daemon), centralized backup

Disadvantages:

1) A large number of small files synchronized longer than the time, sometimes the rsync process stopped

Resolution: 1) package in sync. 2) Drbd method Synchronization (file system synchronous replication block)

2) Synchronization of large files, 10G such large files can sometimes have problems, interrupts. Before the full synchronization, the file is hidden.

You can also schedule automatic backups with timed tasks.


Fast configuration of Rsync file backup service under CentOS

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.