In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-02-24 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)06/01 Report--
This article mainly explains "how to use GIT software to back up web files on the linux system", the content of the article is simple and clear, easy to learn and understand, the following please follow the editor's ideas slowly in depth, together to study and learn "how to use GIT software to back up web files on the linux system"!
BUP is not simply Git, but a software based on Git. Normally, I use rsync to back up my files and have been working well so far. The only drawback is that the file cannot be restored to a specific point in time. So I started looking for alternatives and found BUP, a git-based software that stores data in a warehouse and has the option to recover data to a specific point in time.
To use BUP, you first initialize an empty repository and then back up all files. When BUP completes a backup, it creates a restore point that you can restore to later. It also creates an index of all files, including file properties and verification and. When it comes to the next backup, BUP compares the properties and checksum of the file, saving only the changed data. This can save a lot of space.
Install BUP (passed the test on Centos 6 & 7)
First make sure that you have installed the RPMFORGE and EPEL repositories
[techarena51@vps ~] $sudo yum groupinstall "Development Tools" [techarena51@vps ~] $sudo yum install python python-devel [techarena51@vps ~] $sudo yum install fuse-python pyxattr pylibacl [techarena51@vps ~] $sudo yum install perl-Time-HiRes [techarena51@vps ~] $git clone git://github.com/bup/bup [techarena51@vps ~] $cd bup [techarena51@vps ~] $make [techarena51@vps ~] $make test [techarena51@vps ~] $sudo make install
On CentOS 7, there may be errors when you run make test, but you can continue to run make install.
The first step is to initialize an empty repository, just like git.
[techarena51@vps ~] $bup init
By default, bup stores the warehouse in "~ / .bup", but you can change the setting by setting the environment variable "export BUP_DIR=/mnt/user/bup".
Then, create an index of all files. This index, as mentioned earlier, stores a series of files and their properties and git target id (sha1 hash table). (properties include soft links, permissions, and immutable bytes)
Bup index / path/to/filebup save-n nameofbackup / path/to/file#Example [techarena51@vps ~] $bup index / var/www/htmlIndexing: 7973, done (4398 paths/s). Bup: merging indexes (7980techarena51@vps 7980), done. [techarena51@vps ~] $bup save-n techarena51 / var/www/htmlReading index: 28, done.Saving: 100.00% (4max 4k, 28max 28 files), done.bloom: adding 1 file (7 objects). Receiving index from server: 1268Univer 1268 Done.bloom: adding 1 file (7 objects).
BUP save divides all content into blocks and stores them as objects. The-n option specifies the backup name.
You can view the backup list and backed up files.
[techarena51@vps] $bup lslocal-etc techarena51 test#Check for a list of backups available for my site [techarena51@vps] $bup ls techarena512014-09-24-064416 2014-09-24-071814 latest#Check for the files available in these backups [techarena51@vps] $bup ls techarena51/2014-09-24-064416/var/www/htmlapc.php techarena51.com wp-config-sample.php wp-load.php
Backing up files on the same server is never a good choice. BUP allows you to back up web files remotely, but you must make sure that your SSH key and BUP are installed on the remote server.
Bup index path/to/dirbup save-r remote-vps.com-n backupname path/to/dir
Example: backup "/ var/www/html" folder
[techarena51@vps] $bup index / var/www/html [techarena51@vps] $bup save-r user@remotelinuxvps.com:-n techarena51 / var/www/htmlReading index: 28, done.Saving: 100.00% (4files 4k, 28files), done.bloom: adding 1 file (7 objects). Receiving index from server: 1268 adding 1 file (7 objects).
Restore backup
Log in to the remote server and enter the following command
[techarena51@vps] $bup restore-C. / backup techarena51/latest#Restore an older version of the entire working dir elsewhere [techarena51@vps ~] $bup restore-C / tmp/bup-out / testrepo/2013-09-29-195827#Restore one individual file from an old backup [techarena51@vps ~] $bup restore-C / tmp/bup-out / testrepo/2013-09-29-201328/root/testbup/binfile1.bin
The only drawback is that you can't restore files to another server. You have to copy files manually through SCP or rsync.
View backups through an integrated web server.
Bup web#specific portbup web: 8181
You can use the shell script to run bup and create a scheduled task that runs every day.
#! / bin/bashbup index / var/www/html bup save-r user@remote-vps.com:-n techarena51 / var/www/html Thank you for reading. The above is the content of "how to use GIT software to back up web files on linux system". After the study of this article, I believe you have a deeper understanding of how to use GIT software to back up web files on linux system. The specific use situation still needs to be verified by practice. Here is, the editor will push for you more related knowledge points of the article, welcome to follow!
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.