In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-16 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)05/31 Report--
This article is about how to use the rsync synchronization tool in Linux. Xiaobian thinks it is quite practical, so share it with everyone for reference. Let's follow Xiaobian and have a look.
After configuring the rsync server, the next step is to issue the rsync command on the client to back up the server-side files to the client. Rsync is a very powerful tool, and its commands have many feature options.
1. rsync characteristic
Support copying special files such as linked files, devices, etc.
Can exclude specified file or directory synchronization function, equivalent to tar exclusion function
You can keep the permissions, time, soft and hard links, owners, groups and other attributes of the original file or directory unchanged-p
Incremental synchronization can be achieved, i.e., data whose synchronization changes, so the data transmission efficiency is very high, tar -N
You can use rcp, rsh, ssh, etc. to transfer files (rsync itself does not encrypt data)
Files and data (server and client) can be transferred via socket(process mode)****.
Supports anonymous or authenticated (no system user required) process mode transmission, enabling convenient and secure data backup and mirroring
2. Rsync command formats can be six:
rsync [OPTION]... SRC DEST rsync [OPTION]... SRC [USER@]HOST:DEST rsync [OPTION]... [USER@]HOST:SRC DEST rsync [OPTION]... [USER@]HOST::SRC DEST rsync [OPTION]... SRC [USER@]HOST::DEST rsync [OPTION]... rsync://[USER@]HOST[:PORT]/SRC [DEST]
Corresponding to the above six command formats, rsync has six different modes of operation:
Copy local files. This mode of operation is enabled when neither SRC nor DES path information contains a single colon ":" delimiter. Example: rsync -a /data /backup
Use a remote shell program (such as rsh, ssh) to copy the contents of the local machine to the remote machine. This mode is started when the DST path address contains a single colon ":" delimiter. For example: rsync -avz *.c foo:src
Use a remote shell program (such as rsh, ssh) to copy the contents of the remote machine to the local machine. This mode is enabled when the SRC address path contains a single colon ":" delimiter. rsync -avz foo:src/bar /data
Copy files from a remote rsync server to your local machine. This mode is enabled when the SRC path information contains a "::" delimiter. For example: rsync -av root@172.16.78.192::www /databack
Copy files from your local machine to a remote rsync server. This mode is enabled when the DST path information contains a "::" delimiter. For example: rsync -av /databack root@172.16.78.192::www
Column List of files on remote machine. This is similar to rsync transmission, but only by omitting the local machine information from the command. For example: rsync -v rsync://172.16.78.192/www
3. Rsync three modes
1、Local: rsync [OPTION...] SRC... [DEST] 2、Access via remote shell: Pull: rsync [OPTION...] [USER@]HOST:SRC... [DEST] Push: rsync [OPTION...] SRC... [USER@]HOST:DEST 3、Access via rsync daemon: Pull: rsync [OPTION...] [USER@]HOST::SRC... [DEST] rsync [OPTION...] rsync://[USER@]HOST[:PORT]/SRC... [DEST] Push: rsync [OPTION...] SRC... [USER@]HOST::DEST rsync [OPTION...] SRC... rsync://[USER@]HOST[:PORT]/DEST
4. rsync common parameter options
5. server-side configuration file
[root@localhost /]# cat /usr/local/rsync/rsyncd.conf uid = root gid = root use chroot = no max connections = 5 strict modes = yes port = 8888 pid file = /var/run/rsyncd.pid lock file = /var/run/rsync.lock log file = /var/log/rsyncd.log [backup] path = /tmp/test/ comment = This is a test ignore errors read only = false list = no #hosts allow = 0.0.0.0 auth users = rsync secrets file =/etc/rsyncd/rsyncd.secrets [root@localhost /]# cat /etc/rsyncd/rsyncd.secrets rsync:fswl1234
6. From Linux Backup to Win Local
From linux/rsyncbak directory to windows D:\rsyncbak
cd C:\Program Files\cwRsync\bin\ rsync --port=8888 -vzrtopg --progress --timeout 600 --delete rsync@172.16.5.215::backup /cygdrive/d/rsyncbak
Remember to authorize
7. Transfer from win locally to linux
From windows D:\rsyncbak to linux/rsyncbak
cd C:\Program Files\cwRsync\bin\ rsync --port=8888 -vzrtopg --progress --timeout 600 --delete /cygdrive/d/rsyncbak rsync@172.16.5.215::backup
Thank you for reading! About "how to use rsync synchronization tool in Linux" This article is shared here, I hope the above content can have some help for everyone, so that everyone can learn more knowledge, if you think the article is good, you can share it to let more people see it!
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.