Index: openacs-4/packages/acs-core-docs/www/backup-recovery.html =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-core-docs/www/backup-recovery.html,v diff -u -r1.1.2.1 -r1.1.2.2 --- openacs-4/packages/acs-core-docs/www/backup-recovery.html 29 Mar 2003 20:44:52 -0000 1.1.2.1 +++ openacs-4/packages/acs-core-docs/www/backup-recovery.html 30 Mar 2003 06:04:04 -0000 1.1.2.2 @@ -1,5 +1,5 @@ -Backup and Recovery

Backup and Recovery

+Backup and Recovery

Backup and Recovery

by Don Baccus with additions by Joel Aufrecht
OpenACS docs are written by the named authors, but may be edited @@ -42,21 +42,51 @@ (This should moved into OpenACS's scheduled task project so that it's integrated with OpenACS's alerts and such.)

[service0@yourserver service0]$ export EDITOR=emacs;crontab -e

Add this line to the file. The numbers and stars at the beginning are cron columns that specify when the program should be run - in this case, whenever the minute is 0 and the hour is 1, i.e., 1:00 am every day.

0 1 * * * /usr/local/pgsql/bin/pg_dump -f /web/service0/database-backup/service0_$(date +%Y-%m-%d).dmp service0

Back up the file system

Here's a quick manual way to back up a reference install - it should be replaced by an automated script within - OpenACS. Also watch out for permission problems.

[root@yourserver root]# su - service0
-[service0@yourserver service0]$ tar -cps --file /tmp/service0-backup.tar.bz2 /web/service0
+      OpenACS.  The command excludes the auto-generated
+      supervise directory, which is
+      unneccesary and has complicated permissions.  Make sure that you are using the cron job to back up the database to a file in /web/service0/database-backup so that the tar command will include the database.

[root@yourserver root]# su - service0
+[service0@yourserver service0]$ tar -cpsj --exclude /web/service0/etc/daemontools/supervise --file /tmp/service0-backup.tar.bz2 /web/service0/ --exclude /web/service0/etc/daemontools/supervise/
 tar: Removing leading `/' from member names
-[service0@yourserver service0]$

Restore

  1. Restore the operating system and required software. +[service0@yourserver service0]$

Testing

On a test service, make sure that your backup-recovery process work. After backing up the database and file system, delete the service as detailed below and then recover it.

[root@yourserver root]# svc -d /service/service0
+[root@yourserver root]# mv /web/service0/ /web/service0.lost
+[root@yourserver root]# rm /service/service0
+rm: remove symbolic link `/service/service0'? y
+[root@yourserver root]# ps -auxw | grep service0
+root      1496  0.0  0.0  1312  252 ?        S    16:58   0:00 supervise service0
+[root@yourserver root]# kill 1496
+[root@yourserver root]# ps -auxw | grep service0
+[root@yourserver root]# su - postgres
+[postgres@yourserver pgsql]$ dropdb service0
+DROP DATABASE
+[postgres@yourserver pgsql]$ dropuser service0
+DROP USER
+[postgres@yourserver pgsql]$ exit
+logout
+[root@yourserver root]#

Recovery

  1. Restore the operating system and required software. You can do this with standard backup processes or by keeping copies of the install material (OS CDs, OpenACS - tarball and supporting software) and repeating the install guide.

  2. Restore the OpenACS service. Assuming the user already exists, restore the database and files from backup and restore the daemontools link:

    [root@yourserver root]# su - service0
    +          tarball and supporting software) and repeating the install guide.

  3. Restore the OpenACS service. Assuming the user already exists, restore the database and files from backup and restore the daemontools link. (Because of a bug in Postgres backup-recovery, not all database objects are created in the correct order. To compensate, pre-creating some objects usually work.)

    [root@yourserver root]# su - postgres
    +[postgres@yourserver pgsql]$ createuser service0
    +Shall the new user be allowed to create databases? (y/n) y
    +Shall the new user be allowed to create more new users? (y/n) y
    +CREATE USER
    +[postgres@yourserver pgsql]$ exit
    +logout
    +
    +[root@yourserver root]# su - service0
     [service0@yourserver service0]$ cd /web
     [service0@yourserver web]$ tar xjf /tmp/service0-backup.tar.bz2
    +[service0@yourserver web]$ chmod -R 700 service0
     [service0@yourserver web]$ createdb service0
    +CREATE DATABASE
     [service0@yourserver web]$ psql -f /web/service0/packages/acs-kernel/sql/postgresql/postgresql.sql service0
    +(many lines omitted)
     [service0@yourserver web]$ psql service0 < /web/service0/database-backup/database-backup.dmp
    +(many lines omitted)
     [service0@yourserver web]$ exit
    -[root@yourserver root]# ln -s /web/service0/etc/daemontools /service/
    -[service0@yourserver web]$ svc -u /service/service0
    +[root@yourserver root]# ln -s /web/service0/etc/daemontools /service/service0
    +[root@yourserver root]# sleep 10
    +[root@yourserver root]# svgroup web /service/service0
     [root@yourserver root]#

Other Backup Strategies

Earlier strategies, included here because this section hasn't been fully updated yet.

Set Up Nightly Oracle Exports

(This has not yet been updated to fit with the Reference