Rsync file synchronization application: Client Configuration

Source: Internet
Author: User
Tags auth command line file copy file size file system ssh file permissions rsync

Immediately on the article rsync file synchronization application-server-side configuration, this piece will explain the configuration of the client

Then in the client's words do not need to configure what configuration files, but very upset that these are all the command line, the following will be slowly explained in the client issued rsync command to implement the server-side files back to the client. Rsync is a very powerful tool, and its commands have many features featured options

One, the client installs the Rsync package

[Root@test4 ~]# tar zxvf rsync-3.0.9.tar.gz
[Root@test4 ~]# CD rsync-3.0.9
[Root@test4 rsync-3.0.9]#./configure--prefix=/usr/local/rsync

[Root@test4 rsync-3.0.9]# make && make install

Second, the command format for rsync can be:
rsync [OPTION] ... src [src] ... [user@] Host:dest

rsync [OPTION] ... [user@] HOST:SRC DEST

rsync [OPTION] ... src [src] ... DEST

rsync [OPTION] ... [user@] HOST::SRC [DEST]

rsync [OPTION] ... src [src] ... [user@] HOST::D EST

rsync [OPTION] ... rsync://[user@]host[:P ort]/src [DEST]

Three, Rsync has six different modes of operation:

1, Copy Local files and start this mode of work when both SRC and des path information do not contain a single colon ":" delimiter.
2, use a remote shell program (such as rsh, SSH) to copy the contents of the local machine to the remote machine. This mode is started when the DST path address contains a single colon ":" Separator.
3, a remote shell program (such as rsh, SSH) is used to copy the contents of the remote machine to the local machine. This mode is started when the SRC address path contains a single colon ":" Separator.
4, copy files from remote rsync server to local machine. This mode is started when the SRC path information contains the "::" delimiter.

5, copy files from local machine to remote rsync server. This mode is started when the DST path information contains the "::" separator.

6, the list of files for the remote machine. This is similar to rsync transmission, but simply omitting the local machine information in the command.

Four, rsync parameter options description
-V,--verbose verbose mode output
-Q,--quiet thin output mode
-C,--checksum Open the check switch to force the file transfer to verify
-A,--archive archive mode, which represents the transfer of files recursively and maintains all file attributes equal to-rlptgod
-R,--recursive the subdirectory in recursive mode
-R,--relative using relative path information
Rsync foo/bar/foo.c remote:/tmp/
The foo.c file is created in the/tmp directory, and if the-r argument is used:
Rsync-r foo/bar/foo.c remote:/tmp/
The file/tmp/foo/bar/foo.c is created, which means that the full path information is persisted.
-B,--backup creates a backup, which means that the old file is renamed to ~filename for the same file name already exists for the purpose. You can use the--suffix option to specify different backup file prefixes.
--backup-dir store backup files (such as ~filename) in the directory.
-suffix=suffix defines the backup file prefix
-U,--update only updates, skipping all files that already exist in DST, and the file time is later than the file you want to back up. (Do not overwrite the updated file)
-L,--links retention soft link knot
-L,--copy-links to treat soft links like regular files
--copy-unsafe-links only copies links that point beyond the src Path directory tree
--safe-links ignores links to the SRC path tree
-H,--hard-links keep hard links
-P,--perms keep file permissions
-O,--owner keep file owner information
-G,--group keep file group information
-D,--devices maintain device file information
-T,--times keep file time information
-S,--sparse special handling of sparse files to save DST space
-N,--dry-run which files will be transmitted
-W,--whole-file copy files without incremental detection
-X,--one-file-system do not cross file system boundaries
-B, the block size used by the--block-size=size test algorithm is 700 bytes by default
-E,--rsh=command specifies a shell program that replaces rsh
--RSYNC-PATH=PATH Specifies the path information for the rsync command on the remote server
-C,--cvs-exclude use the same method as CVs to automatically ignore files to exclude files that you do not want to transfer
--existing updates only those files that already exist in DST, not the newly created files
--delete Delete files that are not in the DST SRC
--delete-excluded also deletes the receiving end of files that are excluded by the option specified
--delete-after after transmission is over
--ignore-errors in time IO errors are also deleted
--max-delete=num Delete NUM files up to
--partial retains files that are not fully transmitted for some reason, to expedite subsequent transmissions
--force forcibly deletes a directory, even if it is not empty
--numeric-ids does not match the user and group IDs of numbers to user and group names
--timeout=time IP timeout time in seconds
-I,--ignore-times not skip those files that have the same time and length
--size-only when deciding whether to back up a file, just look at the file size without considering the file time
--modify-window=num the time stamp window that determines whether a file is in the same time, default is 0
-t--temp-dir=dir create temporary files in dir
--compare-dest=dir also compares files in DIR to determine whether a backup is required
-P equals to--partial
--progress Display backup process
-Z,--compress compression of backed-up files on transfer
--EXCLUDE=PATTERN Specifies to exclude file modes that do not require transfer
--INCLUDE=PATTERN Specifies the file mode that is not excluded and needs to be transferred
--exclude-from=file exclude files in the specified mode in file
--include-from=file does not exclude files that match the file-specified pattern
--version Print version Information
--address bound to a specific address
--CONFIG=FILE specifies a different profile and does not use the default rsyncd.conf file
--PORT=PORT Specifies the other rsync service ports
--blocking-io blocking IO for a remote shell
-stats gives the transfer status of some files
--progress transmission process in real time
--log-format=format Specify log file format
--password-file=file gets the password from file
--bwlimit=kbps limit I/O bandwidth, Kbytes per second
-H,--help display Help information

Five, example explanation

The requirements for the previous article are that the/var/www/html and/etc configurations on the backup test3 are as follows

Vim/etc/rsyncd.conf

UID = root
gid = root use
chroot = no
max connections = 2
Strict modes = yes
port = 873
pid file = /var/run/rsyncd.pid
Lock file =/var/run/rsync.lock
log file =/var/log/rsyncd.log
Read Only = yes
List = no
hosts allow = 192.168.87.0/24
[www]
path =/var/www/html
comment = www
ignore errors< C16/>read only = No.
Write only = no
list = no
auth users = ABC
Secrets file =/etc/rsyncd.secrets
  
   [ETC]
path =/etc
comment = etc
Ignore errors
Read Only = no
write only = no
list = no
   
    auth users = ABC Secrets file =/etc/rsyncd.secrets
   
  

TEST3 's IP address is 192.168.87.146

TEST4 's IP address is 192.168.87.129

Configure a password file on the test4
[Root@test4 ~]# Vim/etc/rsyncd.secrets
123456

[Root@test4 ~]# Mkdir/backup/www

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.