For all organizations and companies, data is the most important to them, and even for e-commerce, data is just as important. Rsync is a tool/software that backs up important data over the network. It is also a network protocol for synchronizing folders and files between systems over a network on Unix-like and Window-based systems. Rsync can copy or display directories and copy files. By default, Rsync listens on TCP port 873 and copies files through remote shells such as rsh and ssh. Rsync must be installed on both remote and local systems.
main benefits
rsync is:
Speed: initially will copy all the content between the local and remote. Next time, only the block or byte that changed is transmitted.
Security: Transport can encrypt data via the ssh protocol.
Low bandwidth: rsync can compress and decompress data blocks at both ends.
Syntax:
- #rsysnc [options] source path destination path
Examples: 1 - Enable compression
- [root@localhost /]# rsync -zvr /home/aloft//backuphomedir
- building file list ... done
- .bash_logout
- .bash_profile< Br>
- .bashrc
- sent 472 bytes received 86 bytes 1116.00 bytes/sec
- total size is 324 speedup is 0.58
The above rsync command is used -z to enable compression, -v is visualization, and -r is recursive. The above is synchronized between the local /home/aloft/and /backuphomedir.
Example: 2 - Keep properties of files and folders
- [root@localhost /]# rsync -azvr /home/aloft//backuphomedir
- building File list ... done
- ./
- .bash_logout
- .bash_profile
- .bashrc
- Sent 514 bytes received 92 bytes 1212.00 bytes/sec
- total size is 324 speedup is 0.53
Above we used the -a option, which preserves the owner and group, time Stamp, soft link, permissions, and run in recursive mode.
Example: 3 - Synchronous local to remote host
- root@localhost /]# rsync -avz /home/aloft/[email protected]:192.168.1.4:/share /rsysnctest/
- Password:
- building file list ... done
- ./
- .bash_logout
< Li> .bash_profile
- .bashrc
- sent 514 bytes received 92 bytes 1212.00 bytes/sec
- total size is 324 speedup is 0.53
The above command allows you to synchronize between local and remote machines. You can see that you are prompted to enter a password when synchronizing files to another system. When doing remote synchronization, you need to specify the username and IP or hostname of the remote system.
Example: 4 - Remote sync to local
- [root@localhost /]# rsync -avz [email protected]:192.168.1.4:/share/rsysnctest//home /aloft/
- Password:
- building file list ... done
- ./
- .bash_logout
- .bash_profile
- .bashrc
- sent 514 bytes received 92 bytes 1212.00 bytes/sec
- total size is 324 speedup is 0.53
The above command synchronizes remote files Go to the local.
Example: 5 - Find differences between files
- [root@localhost backuphomedir]# rsync -avzi /backuphomedir /home/aloft/
- building file List ... done
- cd+++++++ backuphomedir/
- >f+++++++ backuphomedir/.bash_logout
- >f+++++++ backuphomedir/.bash_profile
- >f+++++++ backuphomedir /.bashrc
- >f+++++++ backuphomedir/abc
- >f+++++++ backuphomedir/xyz
- sent 650 bytes received 136 bytes 1572.00 bytes/sec< Br>
- total size is 324 speedup is 0.41
The above command helps you find out the difference between a source or destination file or directory.
Example: 6 - BackupThe rsync command can be used to back up linux.
You can use rsync to schedule backups in cron.
- 0 0 * * * /usr/local/sbin/bkpscript &> /dev/null
- vi /Usr/local/sbin/bkpscript
- rsync -avz -e ‘ssh -p2093′ /home/test/[email protected]:/oracle/data/
< Br>
1. Introduction to Firewalls Firewall Concept Firewalls can filter datagrams and restrict specific s
One: ssh schematic is: 1, is to allow the use of ssh between two Linux machines does not require a
This article describes the implementation of malloc and its malloc in the heap expansion operation,
The introduction of the information age has brought great convenience and benefits to our l
Firewall-cmd command in CentOS 7
Install nginx php7 under linux
Linux system virtual memory space
Linux common command directory processing
The small knowledge points used in the Linux system accumulate
Linux remote synchronization data tool rsync
Linux modify file and directory permissions chmod
Windows7 account and permissions explore
RS232/RS422/RS485 communication interface difference
Windows XP account security three measures
How to set the default startup system
The latest screenshot first exposure: This is the official version of Windows 10
There is no sound solution for the computer after installing Windows7
How to set WIFI sharing under Windows8 system
Solution for Flv file cannot be played under the server in 2003.
The system solution that the computer often shuts down automatically