Use rsync command

First, the characteristics of the rsync command

    1. Mirror can save an entire directory tree and file system
     2. You can keep the original permission (permission, mode), owner, group, time (modification time, modify time), soft and hard links, file acl, file attributes (attributes) information, etc.
     3. the high transmission efficiency, the use of synchronization algorithm, transfer only files that have changed
     4.rsync sshd service support based on anonymous transfers, convenient website mirrors; verification can do to enhance security

Second, the use as a command

format:

rsync [OPTIONS] SRC DEST rsync [OPTIONS] SRC [user@]host:DEST rsync [OPTIONS] [user@]host:SRC DEST rsync [OPTIONS] SRC [user@]host::DEST rsync [OPTIONS] [user@]host::SRC DEST

The OPTIONS: -v verbose mode output * -a archive mode, transfer files recursively and keeps attributes of the file, the equals -rlptgoD * --delete delete the SRC DEST no files * - r recursive copy directories - L retains a soft link - P preserving permits - T retention time of the original (modified) - G is a group rights reserved - O reservation owner permissions -D equal --devices - Specials support b, c, s, p type of file - R & lt reserved relative paths - H preserves hard links 

Third, use as a service

1. Create a configuration rsync configuration file and write on demand

[jiangfeng2 the root @ ~] # VI / etc / rsyncd.conf 

[Java] 
path = / App / java_project /   
#java codes stored path 
log File = / tmp / rsync.log   
# define a log file storage path

2. Start Services

[root@jiangfeng1 ~]# rsync --daemon
[root@jiangfeng1 ~]# netstat -nltp| grep rsync
tcp        0      0 0.0.0.0:873                 0.0.0.0:*                   LISTEN      5221/rsync          
tcp        0      0 :::873                      :::*                        LISTEN      5221/rsync

    As can be seen by the netstat command rsync occupied port number is 873

Guess you like

Origin www.cnblogs.com/feng0919/p/11223473.html