WordPress Backups

Ted Roche

Ted Roche & Associates LLC

http://www.tedroche.com/

Ted Roche

Visit tedroche.com for more information, papers, links and more.
  • Using FoxPro 2.5 DOS
  • Using FoxPro 2.5 Windows
  • FoxPro Advanced Developers Handbook
  • FoxPro Windows Multi-User Developer's Guide
  • Hacker's Guide for Visual FoxPro 3
  • Hacker's Guide to Visual FoxPro 6
  • Essential SourceSafe
  • Hacker's Guide to Visual FoxPro 7
  • Office Automation with Visual FoxPro
  • MySQL Client-Server Applications with Visual FoxPro

WordPress Backups: The Outline

Introduction: tell them what you're gonna tell them. At the completion of this session, the attendee will better understand the strategies behind backups, what they will and will not provide, disaster recovery considerations, and what and how to backup WordPress assets.

Spoiler

Spoiler alert. No one cares you religiously ran backups if they can't be restored.

Diagram

Block diagram of relationship between Apache-PHP-MySQL and files on disk for backup

Start Here

The Codex at WordPress.org is the authoritative reference on all things WordPress.

Strategy

Handout notes

What to Backup? Data.

  • Posts & Pages: database contents
  • Need to 'dump' database to a file
  • Codex has recipes for phpMyAdmin and many ISPs
  • Some plugins will also do this
Database content needs to be extracted ("dumped") from the database and backed up.

What to Backup? Files.

  • Files on disk: Wordpress code, themes, uploads
  • Many hosts offer backups of these
  • Test; time them on a restore. 3 days OK?
  • Recognize problem might be ISP down.
  • Alternative: save before you upload
Files on disk include the WordPress source code, the mods to that for your installation (especially database passwords), the plugins and themes you've installed on your site, the files you've uploaded (or others have uploaded) and backups and cache files.

How Many Backups?

  • Thumbrule: three, plus-or-minus two
  • Judge based on activity level,
    • the cost of losing a post,
    • the cost of rebuilding from scratch
  • Location, location, location: off-site
  • Automate or automate reminder (calendar)
Classic IT rotations of full backups, daily incrementals, weekly full dumps, etc. can be overkill for a blog about your cats. Unless your cats are a real money-maker.

Where Do You Backup?

  • On same machine for fast restore
  • On separate machine for computer crash
  • Separate ZIP code for outages
  • Different time zone for disasters
The purpose of a backup is to recover our work in case of an unanticipated accident. The problem with that is that accidents always seem to find the weak link in the chain.

How Crazy Do You Go?

  • Evaluate cost v. risk
  • Simple solutions are often sufficient.
  • Be realistic about cost (in time and effort) and dedication
  • Automated solutions are great, but need to be monitored
  • At a minimum, make a backup now and before each update
Cost-beneift analysis

Disaster Recovery

  • Murphy's Law: Anything that can go wrong will.
    • Anything that can't, will, too.
  • O'Toole's Rule: Murphy was an optimist.
  • Two-plus things will always go wrong
  • That's what distinguishes disasters from Mondays
    • It's not a 'Perfect Storm.' Get over yourself.
Disasters. "Lack of planning on your part does not make a crisis on my part."

Disaster Recovery

  • Hot/warm/cold standby strategies
  • Google might mistake for 'splogging'
  • DNS Issues: content's great, but people have to find it
  • Fireproof safes are usually good for paper NOT MEDIA
    • Fahrenheit 451?
Handout notes

Backing up your own machine (batch,shell,cron)

$cat bin/blog.tedroche.com.backup.sh 
#! /bin/sh

# Dump the Database, overwriting the previous SQL if exists
mysqldump -u wordpress-user -pXXXXxxXXXXxxxXXXxxx ↵
  --skip-lock-tables wordpress ↵
  > ~/blog.tedroche.com.sql
# Compress the SQL, forcing an overwrite
gzip --force /home/troche/blog.tedroche.com.sql
# Send the file 
scp ~/blog.tedroche.com.sql.gz ftp.tedroche.com:
    
This is the database dump, don't forget the files.

Backing up your own machine: files

cd /var/www/html
tar cvzf ~/blog.tedroche.com.20110408.tgz blog.tedroche.com/
   

See the man page for more options like --exclude and --exclude-file

File backups may be available from the ISP Host's tools, or file access through tools like FileZilla or WinSCP.

Demo

  • Backups via WordPress plugins
  • Search WordPress: 350+ available!
  • Backups via S3 or Dropbox
  • Try out a couple of tools and find the right solution for you.
Here I show them what I told them.

Summary

  • Make Backups, Test Restores
  • It Takes Two To Make A Disaster
  • Keep backups in one more location than disaster will strike
  • Try out a couple of tools and find the right solution for you.
Here I tell them what I told them.

Thank you!

Questions?

This document was edited with ViM, http://www.vim.org/ on Linux (also available on OSX, Windows and other fine platforms. Interoperability is Good.

The templates for the document and instructions on their use are the Simple Standards-based Slide Show System, S5 developed by Eric Meyer and available at http://www.meyerweb.com/eric/tools/s5/ under a Creative Commons license. Thanks, Eric!

About the presenter:

Ted Roche learned to program BASIC on a PDP-4 at the age of 15. He was conferencing and IM'ing on the Dartmouth Time Sharing System in the late 1970s. (IM and chat rooms are old. So's Ted.) He shipped his first commercial app in 1978, which ran on a WANG 2200. His first public domain software was a quad-density Epson printer driver for the Commodore 64 GEOS operating system, hand-coded in 6502 assembler. Amigas were his favorite computers, although PCs are getting better. He ran the electrical plant on a nuclear-powered ballistic missile submarine until the Russians gave up, and then there wasn't any challenge in it any more. He has coded with "ohs." (requisite obscure Dilbert reference)

Since 1987, Ted has worked fulltime as a software developer. He has worked for state agencies, insurance companies and consulting firms. He established Ted Roche & Associates on July 4, 2001 . Ted Roche & Associates, LLC develops Web, client-server and LAN-based applications using Ruby on Rails, Python, PHP, Apache, Linux, MySQL, PostgreSQL, Microsoft Visual FoxPro, and other best-of-breed tools. Based in New Hampshire, his company offers consulting, training and mentoring, on-site and long-distance, as well as software development services. Ted is author of Essential SourceSafe, co-author of the award-winning Hacker's Guide to Visual FoxPro series, and a contributor to six other FoxPro books and author of numerous magazine articles. He's a popular speaker at conferences worldwide. Ted is a Microsoft Certified Solution Developer, Microsoft Certified System Engineer, and nine-time winner of the Microsoft Support Most Valuable Professional award. He's earned MySQL certification twice: the Core certification for MySQL 4.x and the Certified Developer certification for 5.x. He was recently recognized by the ACM and inducted as Senior Member.

Ted has worked with Linux since 1999. The Ted Roche & Associates, LLC intranet and extranet run on Apache, Ruby on Rails, PHP, Python, WebMin, MySQL, PostgreSQL and other LAMP applications. Ted's office automation tools include OpenOffice.org, FireFox, Thunderbird, Camino, SciTE, git, Subversion, CygWin, PuTTY, WinSCP and OS X Tiger. In 2005 and 2006, he was one of the team teachers for the LAMP certificate at the New Hampshire Technical Institute's Center for Training and Business Development (http://www.nhti.edu/ctbd) along with Bruce Dawson, Bill Sconce and David Berube. He is the former Fearless Leader and chair of the board (2006-9) of the Greater New Hampshire Linux User Group (http://www.gnhlug.org) and continues to be a LAMP activist with the Central New Hampshire Linux User Group (http://www.centralug.org).

The most current contact information for Ted can be found at http://www.tedroche.com

Valid CSS!

Valid XHTML 1.0!

Creative Commons License
This work is licensed under a Creative Commons Attribution 2.5 License.