Rsync: a very practical file synchronization command, rsync is very practical

Source: Internet
Author: User

Rsync: a very practical file synchronization command, rsync is very practical

Sync is a file synchronization and data transmission tool in Linux. It can be used to synchronize files and release code.

1. install.

Yum install-y xinetd
Yum insatll-y rsync

2. Configuration
Enable rsync vim/etc/xinetd. d/rsync

 

Service rsync {disable = no # change yes to no flags = IPv6 socket_type = stream wait = no user = root server =/usr/bin/rsync server_args = -- daemon log_on_failure + = USERID}
Edit master configuration file
Vim/etc/rsyncd. conf Server

Uid = nobody # The owner Group of the directory or file is nobody. During synchronization, an error is reported, indicating that the user group of the directory file is not authorized.
Gid = nobody
Use chroot = yes
Max connections = 30
Pid file =/var/run/rsyncd. pid
Log file =/var/log/rsyncd. log
List = no

[Data] # synchronization item module [the synchronization item does not need to be added on the server side]
Path =/usr/local/hero_all_backup/
Hosts allow = 192.168.50.146
Read only = yes

Start. Rsync-daemon

3. Use.

Rsync-avz aaa.txt 192.168.0.162: data

####

-V,-verbose detailed mode output

-A,-archive mode, indicating that the file is transmitted recursively and all file attributes are kept

-Z: compresses the backup files during transmission.

-- Delete: delete the files that are not in the SRC file in DST.

-- Exclude = specifies to exclude the file mode that does not need to be transferred.

4. Others.

 

Rsync-avz -- delete/tmp/2 // var/spool/clientmqueue/

Synchronize the useless files in the/tmp/2 empty directory to the/var/spool/clientmqueue/directory.

Rsync-avz -- delete -- exclude = ". svn" -- exclude = "*. swp"

Exclude hidden files of. svn and. swp during synchronization.

 

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.