Freeside:DeprecatedDocumentation:DisasterRecovery

From Freeside
Revision as of 15:00, 5 December 2007 by Rsiddall (talk | contribs) (Quick rewrite of my 9/23/2006 e-mail, with note about using the right switches when creating the PostgreSQL database...)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

Preparation

You can restore a Freeside installation if you have backed up the configuration files, authentication files, and the database (including any encryption keys). freeside-daily will produce a database dump if you have set up the configuration to enable the dump. The configuration and authentication files will change rarely. They can be scp'd or rsync'd to a backup server, or imported into CVS.

This assumes all the versions of software are the same on the old and new machines. If you upgrade anything, you may have to make some alterations to the database schema or the dump file. You're probably better off installing the same version as on the old machine and then doing an upgrade. You will want to keep the tarballs or RPMs you installed from around so you can reinstall Freeside.

How to restore a Freeside installation

PostgreSQL

  • Install the Freeside RPMs or install from the tarball, etc. (You don't do the whole "new install" procedure as you want to restore a database dump instead of creating a new, empty database.)
  • Restore the configuration files. They were in /usr/local/etc/freeside/conf*
  • Create the freeside database user:
	su postgres -c 'createuser -P -A -d freeside'
  • Create an empty freeside database:
	su freeside -c 'createdb -E sql_ascii freeside'
  • If you've been encrypting your database dumps, unencrypt the dump.
  • Assuming your database dump is in /usr/local/etc/freeside/freeside.sql, load that into the database using:
	su postgres -c 'psql freeside < 'usr/local/etc/freeside/freeside.sql'

(Note: you must perform this as the postgres user as the dump contains commands only the database superuser can perform.) (Note: if you're restoring an outsource database instead of the main freeside database, replace the database name, freeside in the example above, with the outsource database name.)

  • Restore any authentication database you use if not using basic HTTP authentication. (Files for this are usually located under /usr/local/etc/freeside.)
  • Run dbdef-create
su freeside -c '/path/to/dbdef-create freeside-user'
  • Restart httpd and the freeside services.
  • Go into the new installation and spot check to make sure that the contents agree with the old installation. (Missing required switches when creating the database can result in an incomplete database restoral.)

MySQL

TBD. Something along these lines:

  • Set the MySQL root password:
mysqladmin -u root password 'set_a_root_database_password'
  • Create the freeside database user:
$ mysql -u root -p
mysql> GRANT SELECT,INSERT,UPDATE,DELETE,INDEX,ALTER,CREATE,DROP on freeside.* TO freeside@localhost IDENTIFIED BY 'set_a_freeside_database_password';
  • Create the freeside database:
mysqladmin -u freeside -p create freeside
  • Restore the database dump after unencrypting it:
mysql -u root -p < /usr/local/etc/freeside/freeside.sql
  • Restore the authentication files and run dbdef-create
/path/to/dbdef-create freeside-user
  • Complete the procedure as for the PostgreSQL instructions above.

Disaster Planning

Doing a practice restoral before going live with Freeside, and doing periodic practice restorals should be part of your disaster plan.

See Also

PostgreSQL users can use slony to maintain a live backup server.