(1) Download the Rsync source code for installation
(2) 1 ' CD rsync
2 './configure--prefix=/usr/local/rsync
3 ' Make
4 ' Make install ( may require permissions, plus sudo resolution )
(3) Rsync command Sync parameters option ( learn )
rsync [OPTION ...] Src... DEST
The frequent use of the parameters option illustrates:
- V,--verbose the specific mode output, the progress of the transmission and other information
-Z,--compress compression during transmission to improve transfer efficiency,--compress-level=num can be compressed by level
- R,--recursive subfolders in recursive mode, where all folders under the folder are transmitted identically. Note that it is lowercase r
-T,--times Keep file time information
-O,--owner Keep file owner information
-P,--perms maintain file permissions
-G,--group keep file group information
- p,--progress Show the process of synchronization and the progress of the transmission and other information
-A,--archive archive mode, which means to transfer files recursively and keep all file attributes equal to -rtopgdl
-D,--devices Keep device file information
-L,--links keep Soft links
- E, the channel protocol used by the--rsh=command. Specifies the Shell program that replaces Rsh . For example:ssh
--exclude=pattern Specify to exclude file modes that do not need to be transferred
   above is a regular use of the parameters: many other parameters please MAN RSYNC  or view data address : http://www.samba.org/ftp/rsync/rsync.html
vza vzrtopgdl
Special tips:
rsync-avz/opt//mnt # Plus / . Synchronizing only the contents of a folder
Rsync-avz/opt/mnt # do not add / . Synchronizes the contents of folders and folders
(4) Server-side configuration:cd/usr/local/rsync
(5) Echo " rsync-pwd " >/usr/local/rsync/rsync.passwd (if permission is required, run the command instead of sudo su root ).
(6) chmod rsync.passwd
(7) vi/usr/local/rsync.conf Additions such as the following:
UID = root
GID = root
Use chroot = no
Max connections = 10000
Strict modes = yes
Address = 192.168.11.73 (the IP address of the server where the server address needs to be synchronized )
PID file =/var/run/rsyncd.pid
Lock file =/var/run/rsync.lock
Log file =/var/log/rsyncd.log
[Public]
Path =/home/public (the folder that needs to be synchronized)
Comment = Web file
Ignore errors
Read Only = no
Write only = no
Hosts Allow =*
List = False
UID = root
GID = root
Auth users = Root,heqiang(This is your own computer username)
Secrets file =/usr/local/rsync/rsync.passwd
(7) start rsyncserver: Before executing, make sure your rsync is open ps-ef|grep rsync
/usr/local/rsync/bin/rsync--daemon--config=/usr/local/rsync/rsync.conf
(8) sudo su root
(9) rsync-avz [email protected]:/home/public//test/(Heqiang is the server computer behind username IP : Next to the folder to be copied the last one is the path to be copied to )
(Ten) prompt for password, enter password! for the other server
(one) sync push:rsync-avz/test/ [email protected]:/home/public/
( rsync-avz)--delete [email protected]:/home/public /test/ --delete The c5> option, which indicates that the data on the client is fully consistent with the server side, and is deleted if there are files that do not exist on the server in the Linuxsirhome folder. Finally, the goal is to keep the data on the Linuxsirhome folder completely consistent with the server, so be careful when you use it. It is best not to take the folder that already has important numbers as the local update folder, otherwise it will delete all of your data.
( --password-file=/etc/rsyncd.secrets )
(+) rsync-avz--password-file =/etc/rsync.password [email protected]:/home/public//test/
Password Copy mode: ( password copy via ssh )
(rsync-avz-e) SSH [email protected]:/home/public//test/
Free Password Login
(+) Ssh-keygen-t DSA ( always Enter)
(+) CD. ssh/
SCP id_dsa.pub [email protected]: ~/ID_DSA_HOSTNAME.PUB (hostname for his computer name )
(+) SSH [email protected]
() Cat Id_dsa_hostname.pub>>.ssh/authorized_keys
Rsync Sync Tool Installation Documentation