plainblack.com
Username Password
search
Bookmark and Share

Backups

As an administrator, backups should be your best friend. You should always make sure you have a good backup at minimum weekly (but every day would be much better), and before every upgrade, just in case something goes badly. The WRE provides a solid and simple backup system, but just in case you chose to do a source install, we'll show you what you need to back up if you want to do it manually.

WRE

WRE backups are pretty simple to configure and perform. This section shows you how to do it.

Start up the WRE Console and go to the Settings tab.

 

Now scroll down to the Backups section and enable backups.

 

Technically you could hit “Save” now and backups would be enabled. But there are lots of other options to configure, so let's cover them as well.

Path tells the backup system where you'd like to store the backup files. Ideally this will be a different drive than the one where your original data is located to protect you in the event of hardware failure.

Rotations is how many copies of the backup data you'd like to keep around. If you're running the backups nightly (which is the default), then this is the number of days worth of data you'll have on hand. You should probably set this as high as you have disk space for. If your site uses 1GB and you have a 100GB drive to store backups on, then you can reasonably keep 90 to 120 rotations (accounting for compression).

Items To Backup allows you to tell the WRE exactly what you want it to back up. The defaults are usually fine, but if you have some other backup system taking care of some portion of this, then you may wish to configure it differently.

External Scripts allows you to write your own scripts to plug in to the backup system. You just enter the full path to your script(s) in the box (one per line. If you make sure that the files it creates are put into the backup path, and are GNU Zipped (ends in .gz) then they'll automatically be rotated and passed along to the FTP server if you're using that option.

 

You may also optionally push your backups to an FTP server on another machine. To configure this, fill out the FTP properties.

Set Enabled to yes if you wish to use the FTP option.

Passive Transfers tells the WRE to enabled the PASSV command while transferring data. This is necessary if your FTP server is behind a firewall or can't open a separate data port for transmission.

Rotations is the same as the backup rotations setting, except that this is how many rotations will be kept on the FTP server.

Host is the name or IP address of the machine where your FTP server lives.

Path is the path to the directory on the FTP server where you'd like to upload files. Note that this should be an empty folder on your FTP server, where no other files or folders exist. If it is not those files and folders will get rotated out of existence by the backup process.

Auth is the username and password used to connect to the FTP server.

 

Hit “Save” when you are done.

Backups will now be processed every night at 2am (02:00), unless you have changed the default time when you set the cron job during the install process.

Manual

The following process will show you how to back up your WebGUI files manually. Since you're going to want to back up your sites regularly, you'll probably want to turn this into a script that can be run by a cron job.

WebGUI

To back up WebGUI run the following commands:

cd /data

tar cvfz /path/to/backup/webgui.tar.gz WebGUI

 

Databases

To back up a site's database run the following commands:

mysqldump -uroot -p123qwe www_example_com > \

/path/to/backup/www_example.com.sql
cd /path/to/backup

gzip www_example_com.sql

 

Repeat this process once for each site's database.

While it may be tempting to just back up the raw database files, it is not safe to do that unless you shut down MySQL completely, therefore mysqldump is much safer. In addition, the file produced by mysqldump can be transported across architectures, where the binary database files cannot.

Web Roots

To back up each site's web root run the following commands:

cd /data/domains/www.example.com

tar cvfz /path/to/backups/www.example.tar.gz *

 

Repeat these commands once for each site.

Restoration

The restoration process is the same whether you are using WRE backups, or you have backed up your data manually. Follow these steps.

Restore WebGUI by running the following commands:

cd /data
rm -Rf WebGUI
tar xvfz /path/to/backup/webgui.tar.gz

 

Restore a site's database by running the following commands:

mysql -uroot -p123qwe -e “drop database www_example_com”

mysql -uroot -p123qwe -e “create database www_example_com”

gunzip /path/to/backup/www_example_com.sql.gz

mysql -uroot -p123qwe www_example_com < /path/to/backup/www_example_com.sql

 

Restore a site's web root by running the following commands:

rm -Rf /data/domains/www.example.com/*

cd /data/domains/www.example.com

tar xvfz /path/to/backup/www.example.com.tar.gz

 

Keywords: back up database restore

Search | Most Popular | Recent Changes | Wiki Home
© 2018 Plain Black Corporation | All Rights Reserved