1 Make sure you have backup all data and database.
How to back up your view of all code Guide and automatic database backup to a server / VPS others. Before installing the VPS, you run the last backup_VPS.sh file to backup the latest data offline.
2 Reinstall the VPS by HZserver
(If you only restore the VPS from VPS backups do not need to do this step)
After you have finished running backup_VPS.sh. Please login to your control panel VPS provider, then select rebuild the VPS. To be HZserver use PHP-FPM to install, MariaDB and Nginx and managed VPS, you need to select the CentOS 6 operating system, 64-bit okay.
Next, install as instructed in post HZserver Install Nginx, PHP-FPM, MariaDB and easily managed VPS, with HZserver security.
3 Create the database before restoring the VPS
On VPS need to recover, you log into SSH and access the menu and select the function hzserver 4 to create a database to restore. And user password must match the offline database backup. We have how many database backup, you need to make this much more offline database.
4 Add more domains on VPS just installed
Your use of the domain to add functionality to add the domain HZserver we need to recover okay.
But HZserver access function keys menu and select one to use.
We will add full domain domain offline. Next to the public_html folder of this domain delete all index.html files go offline!
5 To connect to the VPS VPS backup without entering the password
Now we will allow to connect to VPS VPS backup without the password:
On VPS backups you type the command:
1
ssh-keygen f ~ / .ssh / id_rsa q-P “”
followed by:
1
ssh-copy-id-i ~ / .ssh / id_rsa.pub IP_VPS_chinh
for example, your main VPS IP 123 456 789, we use the command:
1
ssh-copy-id-i ~ / .ssh / id_rsa.pub 123 456 789
then we enter the password VPS is completed.
6 Create Script to transfer all the backup files from the backup VPS VPS one already installed.
After we had to connect to VPS VPS backup without importing the. I will create a script to transfer all the code and database backup in the VPS back. Upload and download speeds are faster on VPS, so if your backup storage up to tens of GB, it also takes a few minutes to complete this work.
In this Guide, and automatic database backup code to a server / VPS I have divided into two different cases generated script:
Where is MySQL MyISAM engine and MysSQL case with the InnoDB engine or any other engine. However, if you use if you use VPS HZserver to manage the MySQL default MyISAM engine, so we just need to transfer back to the folder and MySQL code is finished.
1 case with MySQL’s MyISAM engine
Create a file on your computer restore.sh with the following contents:
1
2
3
#! / bin / bash
rsync-e ssh -avz / home / backup / home / root @ IP_VPS_Chinh: / home /
rsync-e ssh -avz / home / backup / mysql / root @ IP_VPS_Chinh: / var / lib / mysql /
Then you use a file upload as winscp or filezilla restore.sh up one directory / bin / backup on the VPS. Following this file chmod 755.
Continued access to SSH and run the script restore.sh VPS backup to transfer all data and code database tent on the main VPS
Perform command:
1
restore.sh
you wait a few minutes to transfer data on the VPS. After Rsync complete data. You need to restart Nginx and MySQL, php-fpm to complete
1
2
3
service nginx restart
php-fpm service restart
service mysql restart
So we finished restoring backup VPS from VPS. We will take about 10 minutes to complete VPS restoration to normal site activities.
2 Case with MysSQL engine is InnoDB or any other engine.
It is the MyISAM engine with MysSQL can in the quickest way. But you still can use the following way.
Create restore.sh similar script to move the code and database to the VPS.
1
2
3
#! / bin / bash
rsync-e ssh -avz / home / backup / home / root @ IP_VPS_Chinh: / home /
rsync-e ssh -avz / home / backup / backupmysql / root @ IP_VPS_Chinh: / home / backupmysql /
upload to / bin / then chomd 755 files, run commands on a VPS restore.sh backup to move backup file on the VPS.
After you run restore.sh complete, code and database backup was transferred to the VPS. At this site may not work because only code that does not have a database. Now we need to import the database. As in all automatic Guides code and database backup to a server / VPS else we use mysqldump to backup a database, so now we are going to use mysqldump to restore database.
You see the instructions for backing up and restoring with mysqldump mysql okay.
7 Turn on VPS VPS backup login without entering the password
You run the following command on the backup VPS to turn off the ability to login to your VPS without entering a password in the previous step we have to do.
1
ssh-keygen-R IP_VPS_chinh
At this point everything is finished. We have finished restoring the VPS. If you restore each section, change the content according to their needs restore.sh okay.
If you do not have backup VPS, VPS packages you can buy 128 MB SSD cache with 50 GB of hard drive space as Hostingaz.vn are using. See also: Coupon Ramnode 42% lifetime discount
Leave a Reply