Now see more and more vpser start using VPS, in the use of VPS when a very important task is to provide backup VPS, although some IDC also provides VPS backup services, but either is the charge, are not very suitable for us to use these vpser.
Today introduce a simple method for your own VPS backup.
1, the use of Putty login VPS, here is not much introduced.
2, Backup Site Directory:
Copy Code code as follows:
[Root@www ~]# cd/web/www/Enter the corresponding directory
[Root@www www]# tar zcvf vps.tar.gz VPS//Use tar packaged and compressed VPS folder, compressed file name: vps.tar.gz
[Root@www www]#
3, BACKUP database:
Method One: Use phpMyAdmin to back up the database
Method Two: Automatically back up the database using mysqldump timing
[Root@www www]# vi backup-db.sh#!/bin/sh
/usr/local/mysql/bin/mysqldump-uroot-ppassword databasename >/web/www/db-backup/databasename$ (date + "%Y%m%d"). Sql
rm/web/www/db-backup/databasename$ (date-d -7day + "%y%m%d"). SQL#上面语句删除7天前的备份
The above script-U after the database user name, –p after the database user password,databasename changed to the database name to be backed up, you can also back up all the database will databasename modified to--all-databases, back/web/www/ db-backup/is the directory that is backed up.
Add a timed execution task
[Root@www ~]# crontab-e/root/backup-db.sh
Daily 23:59 chapters automatically back up the database, and the resulting database compression is named by date
The above backup of the information, the backup is done quickly to download the backup to the local, after all, the backup data are in the VPS, not around.
>> Reprint Please indicate the Source: VPS Detective