In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-04-02 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)06/03 Report--
The whole website is usually very large, especially the static pictures and videos, but we usually do not modify them. We usually only modify a few files. If we upload the entire site from the local to the server every update, it will undoubtedly take a lot of time. If you want to find the modified files, and only upload these files, or even upload only the modified parts of these files, it will undoubtedly be much more convenient.
This will be useful until today's protagonist Rsync,Rsync can perform an incremental backup, which only transfers the inconsistent parts between the source file and the target file.
Environment:
Web server root directory / usr/share/nginx/game.shaochenfeng.com
Local project directory / git/game.shaochenfeng.com/public
First of all, it is recommended to configure the local ssh password-free login to the web server [how about?] (), do not configure that you need to enter a password for each synchronization in the future
1. Install rsync on the web server side
You can install yum or apt directly, both on the server side and locally.
Yum install rsync # Red Hat apt install rsync # Debian
Why install rsync on the server as well? Because although the link is established through ssh, rsync uses its own transport rules, not scp
two。 Push to the server
Execute locally, synchronizing the local project directory to the web server root directory
Rsync-avz-delete www@192.168.56.10:rsync-avz-delete / git/game.shaochenfeng.com/public www@192.168.56.10:/usr/share/nginx/game.shaochenfeng.com
Where the parameters
-an is a recursive transfer and maintains the file properties, used when transferring with folders, and preserves the file properties-v shows the transfer process-z for compressed transfer to improve efficiency-delete locally deleted files will also be deleted on the server with rsync common options
-a contains-rtplgoD
-r Recursive transfer synchronization is used when there are folders
-v shows the transmission process
-l keep the soft connection
-p keep permission attribute
-O keep the owner
-g retention group
-D keep device file information
-t keep the time attribute of the file, this must be there, otherwise the next synchronization can not determine which files have been modified
-- backup makes a backup of the files that already exist on the server. The file name of the backup is suffixed with "~" by default.
Files deleted locally by delete will also be deleted on the server
-- exclude filters specified files, such as-- exclude "logs" will filter out files or directories whose filenames contain logs, out of sync
-P shows the synchronization process, such as speed, in more detail than-v
-u with this option added, if the files in DEST are newer than SRC, they will not be synchronized
-- size-only default algorithm checks modification time and file size, plus this only checks file size
-z for compressed transmission to improve efficiency
Welcome to visit my official website and check the technical article www.shaochenfeng.com of operation and maintenance.
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.