210 likes | 695 Views
RSYNC. Outline. Introduction Algorithm Features examples. Introduction. A replacement of RCP(remote file copy) that has more feature. It uses the “rsync Algorithm” to bring remote file into sync. It only send the difference across the link. Algorithm. A has new version f’.
E N D
Outline • Introduction • Algorithm • Features • examples
Introduction • A replacement of RCP(remote file copy) that has more feature. • It uses the “rsync Algorithm” to bring remote file into sync. • It only send the difference across the link.
Algorithm A has new version f’ B has old version f 2. B sends the checksums to A 4.A tells B how to construct file f’ from f and the literal data. 1.B computes the checksum of each block Si in file f 3. A searches the file f’ and find the difference between f and f’. The checksum consist of “rolling” 32-bit checksums and a 128-bit MD4 checksum.
Feature • Can update while directory trees and filesystems. • Can use rsh , ssh, or direct socket as the transport. • Support anonymous login which is ideal for mirroring.
Rsync examples • Linux 裝好時就有了, 不需另外安裝. • 執行方式 : rsync --daemon • Port : 873 • Conf 檔: /etc/rsyncd.conf
Conf example [ftp] path = /home/ftp comment = ftp services host allow = 140.113.23.0/24 max connections = 4 [personal] path = /home/eric comment = my personal field. read only = yes auth users = eric secret file = /etc/rsyncd.secrets
Rsync useage • 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::DEST • rsync [OPTION]... rsync://[USER@]HOST[:PORT]/SRC [DEST]
Rsync example • List the modules on server rsync 140.113.56.71:: • Backup local file: rsync -azv /home/eric/doc /tmp/backup • Copy files from remote server rsync -azv 140.113.56.71::ftp/hw2 ~/
Use ssh & rsh • With ssh communication rsync -azv -e ssh adm@ftp.nctu.edu.tw:ftp/WWW /home/ftp • Use rsh commands rsync -avR remote:'`find /home -name "*.[cpp]"`' /tmp/
Reference http://rsync.samba.org Man pages of rsync & rsyncd.conf