In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-19 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)06/01 Report--
This article focuses on "steps to install and use Rsync for synchronization on Linux". Interested friends may wish to take a look. The method introduced in this paper is simple, fast and practical. Let's let the editor take you to learn the steps of installing and using Rsync for synchronization on Linux.
For a variety of organizations and companies, data is the most important to them, even for e-commerce. 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 the network on Unix-like and Window-like systems. Rsync can copy or display directories and copy files. Rsync listens to TCP port 873 by default and copies files via remote shell such as rsh and ssh. Rsync must be installed on both remote and local systems.
The main benefits of rsync are:
Speed: everything is initially copied between local and remote. Next time, only the changed blocks or bytes will be transferred.
Security: the transmission can encrypt data through the ssh protocol.
Low bandwidth: rsync can compress and decompress data blocks at both ends.
Syntax:
The code is as follows:
# rsysnc [options] source path destination path
Example: 1-enable compression
The code is as follows:
[root@localhost /] # rsync-zvr / home/aloft/ / backuphomedir
Building file list... Done
.bash _ logout
.bash _ profile
.bashrc
Sent 472 bytes received 86 bytes 1116.00 bytes/sec
Total size is 324 speedup is 0.58
The above rsync command uses-z to enable compression,-v is visual, and-r is recursive. The above synchronizes between the local / home/aloft/ and / backuphomedir.
Example: 2-preserve the properties of files and folders
The code is as follows:
[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-an option, which retains everyone and their groups, timestamps, soft links, permissions, and runs in recursive mode.
Example: 3-synchronize local to remote host
The code is as follows:
Root@localhost /] # rsync-avz / home/aloft/ azmath@192.168.1.4:192.168.1.4:/share/rsysnctest/
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 allows you to synchronize between local and remote machines. You can see that you are prompted for a password when synchronizing files to another system. When doing remote synchronization, you need to specify the user name and IP or hostname of the remote system.
Example: 4-synchronize remotely to local
The code is as follows:
[root@localhost /] # rsync-avz azmath@192.168.1.4: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 locally.
Example: 5-find out the differences between files
The code is as follows:
[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
Total size is 324 speedup is 0.41
The above command helps you find the difference between the file or directory between the source address and the destination address.
Example: 6-backup
The rsync command can be used to back up linux.
You can use rsync in cron to schedule backups.
The code is as follows:
0 * / usr/local/sbin/bkpscript & > / dev/null
Vi / usr/local/sbin/bkpscript
Rsync-avz-e'ssh-p2093' / home/test/ root@192.168.1.150:/oracle/data/
At this point, I believe you have a deeper understanding of the "steps to install and use Rsync for synchronization on Linux". You might as well do it in practice. Here is the website, more related content can enter the relevant channels to inquire, follow us, continue to learn!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.