Some hands-on experience is required! If you have never used the command line, please contact one of our partners to get some assistance.
To restore your Hypernode from a backup use the steps below.
TABLE OF CONTENTS
- Restore Using Snapshots
- Restore on DigitalOcean
Restore Using Snapshots
On Amazon (AWS) and Combell OpenStack we use snapshots to create backups. A snapshot is a saved state of the /data device at a given moment in time. We can use this to create a static copy of that given state in time and transform this to a virtual device which we can attach to your Hypernode. Once attached, this device is mounted under
/data/backup and you can easily restore your files by copying them from this file system.
By using the following command you attach the latest available snapshot to your node:
The backup snapshot is automagically detached/unmounted overnight, before the backups are made. There is a second MySQL instance running so you’ll lose some resources while it is attached. Please contact Support if you want the snapshot detached earlier, to save on resources.
For DigitalOcean, please see Restore on DigitalOcean
Restore a Database From Snapshots
Create a Database Dump
To create a database dump from the backup instance, connect to port 3307 with the mysqldump utility and create a dump:
mysqldump $DATABASE -P 3307 | gzip > /data/web/$DATABASE.sql.gz
When the export is created, a backup file can be found in
/data/web named after the database, with the
Dump the Data From the Backup MySQL Instance Into the Production Database
To restore the backup and immediately import it in the production database use the following command:
mysqldump $DATABASE -P 3307 | mysql $DATABASE
While attaching a snapshot to your Hypernode does not require any resources, creating a database dump does require CPU, so please keep this in mind when doing so.
Restore a File Backup From a Snapshot
To restore your files, copy the files from
/data/backup/current to your
**Assuming the environment has the default Magento root directory setup you can restore the file backup with the following commands. If you have an alternative setup, you should change the Magento root directory in the commands below:
mv /data/web/public /data/web/public_backup ##Rename the magento root directory so you still have a backup of the files
mkdir /data/web/public ##Generate new public directory
cp -R /data/backup/current/web/public/* /data/web/public/ ##Copy the files from the backup to the new public directory
mv /data/web/magento2 /data/web/magento2_backup ##Rename the magento root directory so you still have a backup of the files
mkdir /data/web/magento2 ##Generate new magento2 root directory
cp -R /data/backup/current/web/magento2/* /data/web/magento2/ ##Copy the files from the backup to the new public directory
Restore on DigitalOcean
Restore a Database Backup on DigitalOcean
When we restore a database backup, you’ll find a database dump compressed with gzip.
The name of this backup has the format
To restore this backup you can use either magerun or use the MySQL client utility:
First unzip the back-up file:
For Magento 1:
magerun db:import --root-dir=~/public database_name_01-01-2018.sql
For Magento 2:
magerun2 db:import --root-dir=~/magento2 database_name_01-01-2018.sql
Using MySQL client:
zcat database_name_01-01-2018.sql.gz | mysql database_name
And then wait until the database is fully imported.
This might take a while for large databases, so get yourself some coffee in the meantime.
Restore a File Backup on DigitalOcean
When you request a file backup on a Hypernode at DigitalOcean, we create a directory in your homedir in which we restore from a certain point in time.
To restore this backup, remove the old file or directory and copy the file(s) and/or directories in place in your
IE: if you need to restore the var directory, use the command:
rm -rvf /data/web/public/var/ && mv restore/var /data/web/public/
If you need some visual assistance, you can use mc (midnight commander).