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)06/02 Report--
This article describes the CentOS platform to achieve an example of the establishment of rsync remote synchronization server method. Share it for your reference, as follows:
rsync (remote synchronize) is a remote data synchronization tool that can quickly synchronize files between multiple hosts over LAN/WAN, or use rsync to synchronize different directories on your local hard disk.
Difference between rsync and scp:
rsync supports incremental synchronization, whether it is the number of new files or the content of new files, scp does not
Notes:
1. Centos has installed rsync by default. Enter the command rsync to view it. If it does not work properly, please refer to the link at the end of the article for operation.
2. rsync will only synchronize incrementally, from the server. If you delete the next synchronization, there will be--delete Delete files in the target directory that are redundant than the source directory.
3. Synchronous command can be executed by program, timed execution or manual execution.
4. Remember to restart service xinetd restart after modifying the configuration file
5. The file is very large. First tar the package and compress it before transmitting it.
Serial number IP address Abbreviation 1192.168.46.32A Machine 2192.168.46.11B Machine
First look at the files in the logs folder on machine A:
[root@h2 logs]# ll
Total consumption 4
-rw-r--r-- 1 root root 3 Aug 30 02:29 a.txt [root@h2 logs]#
Then, on machine B, we execute the synchronization command as follows:
[root@h3 logs]# ll
Total consumption 0
[root@h3 logs]# rsync -av --delete 192.168.46.32:/root/logs /root/logg/receiving incremental file listlogs/logs/a.txtsent 34 bytes received 107 bytes 282.00 bytes/sectotal size is 3 speedup is 0.02[root@h3 logs]# ll
Total consumption 4
-rw-r--r-- 1 root root 3 Aug 30 02:29 a.txt [root@h3 logs]#
Then, we add a b.txt to the log file on machine A and test the synchronization command:
[root@h3 logs]# rsync -av --delete 192.168.46.32:/root/logs /root/logg/receiving incremental file listlogs/logs/b.txtsent 34 bytes received 125 bytes 318.00 bytes/sectotal size is 5 speedup is 0.03[root@h3 logs]#
Through the log, we found that if we added a new file that was only synchronized with rsync: now we add a new line to the a.txt file under the log folder on server A and execute the synchronization command again:
[root@h3 logs]# rsync -av --delete 192.168.46.32:/root/logs /root/logg/receiving incremental file listlogs/a.txtsent 37 bytes received 128 bytes 330.00 bytes/sectotal size is 9 speedup is 0.05[root@h3 logs]#
We found that the rsync command can also be recognized very well. Finally, let's take a look at it and change the a and b files on server A at the same time. One adds a line and one deletes a line to measure the increment:
[root@h3 logs]# rsync -av --delete 192.168.46.32:/root/logs /root/logg/receiving incremental file listlogs/logs/a.txtlogs/b.txtsent 65 bytes received 174 bytes 478.00 bytes/sectotal size is 10 speedup is 0.04[root@h3 logs]#
We found that rsync was also very good at recognizing it. Finally, let's take a look at how to send data from server B to server A. Note that the demonstration just above is to download data from server B on server A. Now we want to demonstrate how to actively send data from server B to server A. The principle is the same. It is all operated in an incremental manner, but the IP is written in a different position:
[root@h3 logs]# rsync -av --delete /root/logg/logs/b.txt 192.168.46.32:/root/sending incremental file listb.txtsent 87 bytes received 37 bytes 248.00 bytes/sectotal size is 10 speedup is 0.08[root@h3 logs]#
Reference article:
https://www.jb51.net/article/138864.htm
https://www.jb51.net/article/138866.htm
I hope this article is helpful for CentOS server configuration.
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.