Recover an oCIO Web Hosted Site

OCIO Web Hosting now keeps a 14-day daily backup of your hosted Document Root & its associated databases. These backups are overwritten every 14 days. This document is a step-by-step explanation of how to recover a broken host with these backups, and assumes the user has a working knowledge of Linux CLI and MySQL.

Contents

  1. Backup existing database (Just In Case)
  2. Begin Recovery of Files from Webhosting Dashboard
  3. Drop existing Database Tables (Optional)
  4. Check on Recovery Status
  5. Relocate recovered flat files
  6. Import recovered Database(s)
  7. Clear Cache & Test
  8. Remove Recovered Files
  9. Help


 

1. Backup existing database (Just In Case)

Connect to Webhosting CLI with your favorite terminal emulator. 

https://web.osu.edu/technical-support/shell-access

Login with your Name.# and Duo, choose the site that needs repair, and go to your Webhosting Document Root

cdweb

Backup the existing database, just in case …

mysqldump -u [username] -p -h webdb1.service.ohio-state.edu [database_name] > [database_name_and_todays_date].sql

Enter the database Password when prompted.

Ensure the dump contains data

tail -n 50 [database_name_and_todays_date].sql

 

2. Begin Recovery of Files from Webhosting Dashboard

The recovery process takes anywhere for a few minutes to several hours, depending on the size of your site & if you have a multi-site environment. Start this process as soon as you can.

Open your favorite Web Browser and navigate to https://web.osu.edu

Login and navigate to the site having issues, Select the correct instance tab (typically Prod), click on the ‘Restore’ tab & then on ‘Get Snapshots’.

Begin

Choose your Restore Point and click “Select”.  (I chose April 3rd)

Restore_Status

After selecting the backup date you want, you will be taken to a status screen that will auto update with how far along the backup is. Once complete, you will have a new folder in your document root, but as I mentioned earlier, this process can take a while to complete.  Let’s move on while the restoration takes place in the background.

3. Drop existing Database Tables (Optional)

If you believe the source of the site failure lies in the structure of its database, (ie: After a failed Drupal Update) you may want to drop all the existing tables before importing the backed-up SQL file, as the import will only overwrite tables and structures that existed at the time of the backup.  In most cases this will be unnecessary.

Open your favorite Web Browser and navigate to https://web.osu.edu

Login and navigate to the site having issues, Click on the Database Menu & then on phpMyAdmin.

Database_Drop

Login with the database’s username & password.

phpMyAdmin

Choose the database you want to Drop

Database_Choice

And scroll to the bottom of the page.

Database_Drop

Click the ‘Check All’ box and choose ‘Drop’ from the ‘With selected’ menu bar.

Drop_Menu

Click (Yes)

Drop_Complete

Cleanup complete!

No_Tables

 

4. Check on Recovery Status

Periodically click the [Get Restore Status] button in the Restore section on Webhosting Dashboard to see if the Restoration completed. once complete, it will show up in the list of completed jobs.

Recovery_Status

Once complete, you will find a new directory in your sites document root entitled:

aws_backup_restore_[restore_date_and_time]

Terminal

This directory is an exact copy of your webroot files, along with a copy of any associated database(s), taken on the date selected earlier in the Webhosting Dashboard.  The database backup is in a subfolder entitled “sqlbackup”. 

Please Note!
The recovery subfolder is named for the date & time the restoration was completed, not the date & time of the original backups.

 

5. Relocate recovered flat files

From here it is simply a matter of copying & pasting any (Or all) of files & folders you need from the recovery subfolders to their proper location(s) under your Webroot. You can do this using any method you feel comfortable with.

6. Import recovered Database(s)

Connect to Webhosting CLI with your favorite terminal emulator.  Here’s How:

https://web.osu.edu/technical-support/shell-access

Login with your Name.# and Duo, choose the site that needs repair. Then go to your Webhosting Document Root

cdweb

Enter this command, replacing the italicized portions with the names of your environment components:

zcat aws-backup-restore_[date_and_time]/[subfolder_if_used]/sqlbackup/[Recovered_database_backup_date_and_time].sql.gz | mysql -u [database_user] -p -h webdb1.service.ohio-state.edu [Target_Database]

This will restore a copy all of backed-up tables & data into your database(s) listed in the Database section of the Webhosting Dashboard.

7. Clear Cache & Test

Before testing your recovered site, be sure to clear any Cache from your browser(s) and any Web Content Management Software (ie: Drupal, WordPress, Joomla, etc.) you may be using.  

8. Remove Recovered Files

Once your site is back On-Line, the files you recovered in Steps #1, #2, & #4 are just taking up space. And depending on the size of your website(s) they may be taking up A LOT of space.  Be sure to delete them!

9. Help

As Always, if you have problems with any of these processes, please create a Help Desk Ticket at:

https://go.osu.edu/it