Index: openacs-4/packages/acs-core-docs/www/snapshot-backup.html =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-core-docs/www/snapshot-backup.html,v diff -u -r1.2 -r1.2.2.1 --- openacs-4/packages/acs-core-docs/www/snapshot-backup.html 20 Feb 2004 15:13:42 -0000 1.2 +++ openacs-4/packages/acs-core-docs/www/snapshot-backup.html 5 Jul 2004 19:47:31 -0000 1.2.2.1 @@ -63,15 +63,15 @@ . exporting dimensions . exporting post-schema procedural objects and actions . exporting statistics -Export terminated successfully without warnings.
  • PostgreSQL.�Create a backup file and verify that it was created and has a reasonable size (several megabytes).

    [root root]# su - service0
    -[service0 service0]$ pg_dump -f /var/lib/aolserver/service0/database-backup/before_upgrade_to_4.6.dmp service0
    -[service0 service0]$ ls -al /var/lib/aolserver/service0/database-backup/before_upgrade_to_4.6.dmp 
    --rw-rw-r-x    1 service0  service0   4005995 Feb 21 18:28 /var/lib/aolserver/service0/database-backup/before_upgrade_to_4.6.dmp
    -[service0 service0]$ exit
    +Export terminated successfully without warnings.
  • PostgreSQL.�Create a backup file and verify that it was created and has a reasonable size (several megabytes).

    [root root]# su - $OPENACS_SERVICE_NAME
    +[$OPENACS_SERVICE_NAME $OPENACS_SERVICE_NAME]$ pg_dump -f /var/lib/aolserver/$OPENACS_SERVICE_NAME/database-backup/before_upgrade_to_4.6.dmp $OPENACS_SERVICE_NAME
    +[$OPENACS_SERVICE_NAME $OPENACS_SERVICE_NAME]$ ls -al /var/lib/aolserver/$OPENACS_SERVICE_NAME/database-backup/before_upgrade_to_4.6.dmp 
    +-rw-rw-r-x    1 $OPENACS_SERVICE_NAME  $OPENACS_SERVICE_NAME   4005995 Feb 21 18:28 /var/lib/aolserver/$OPENACS_SERVICE_NAME/database-backup/before_upgrade_to_4.6.dmp
    +[$OPENACS_SERVICE_NAME $OPENACS_SERVICE_NAME]$ exit
     [root root]#
    -su - service0
    -pg_dump -f /var/lib/aolserver/service0/database-backup/before_upgrade_to_4.6.dmp openacs-dev
    -ls -al /var/lib/aolserver/service0/database-backup/before_upgrade_to_4.6.dmp
    +su - $OPENACS_SERVICE_NAME
    +pg_dump -f /var/lib/aolserver/$OPENACS_SERVICE_NAME/database-backup/before_upgrade_to_4.6.dmp openacs-dev
    +ls -al /var/lib/aolserver/$OPENACS_SERVICE_NAME/database-backup/before_upgrade_to_4.6.dmp
     exit
  • Back up the file system.�Back up all of the files in the service, including the database backup file but excluding the auto-generated supervise directory, which is @@ -82,51 +82,51 @@ break anything by omitting them.

  • The --file clause specifies the name of the output file to be generated; we manually add the correct extensions.

  • The last clause, - /var/lib/aolserver/service0/, + /var/lib/aolserver/$OPENACS_SERVICE_NAME/, specifies the starting point for backup. Tar defaults to - recursive backup.

  • [root root]# su - service0
    -[service0 service0]$ tar -cpsz --exclude /var/lib/aolserver/service0/etc/daemontools/supervise \
    -   --file /tmp/service0-backup.tar.gz /var/lib/aolserver/service0/
    +            recursive backup.

    [root root]# su - $OPENACS_SERVICE_NAME
    +[$OPENACS_SERVICE_NAME $OPENACS_SERVICE_NAME]$ tar -cpsz --exclude /var/lib/aolserver/$OPENACS_SERVICE_NAME/etc/daemontools/supervise \
    +   --file /tmp/$OPENACS_SERVICE_NAME-backup.tar.gz /var/lib/aolserver/$OPENACS_SERVICE_NAME/
     tar: Removing leading `/' from member names
    -[service0 service0]$
  • Suffer a catastrophic failure on your production system.�(We'll simulate this step)

    [root root]# svc -d /service/service0
    -[root root]# mv /var/lib/aolserver/service0/ /var/lib/aolserver/service0.lost
    -[root root]# rm /service/service0
    -rm: remove symbolic link `/service/service0'? y
    -[root root]# ps -auxw | grep service0
    -root      1496  0.0  0.0  1312  252 ?        S    16:58   0:00 supervise service0
    +[$OPENACS_SERVICE_NAME $OPENACS_SERVICE_NAME]$
  • Suffer a catastrophic failure on your production system.�(We'll simulate this step)

    [root root]# svc -d /service/$OPENACS_SERVICE_NAME
    +[root root]# mv /var/lib/aolserver/$OPENACS_SERVICE_NAME/ /var/lib/aolserver/$OPENACS_SERVICE_NAME.lost
    +[root root]# rm /service/$OPENACS_SERVICE_NAME
    +rm: remove symbolic link `/service/$OPENACS_SERVICE_NAME'? y
    +[root root]# ps -auxw | grep $OPENACS_SERVICE_NAME
    +root      1496  0.0  0.0  1312  252 ?        S    16:58   0:00 supervise $OPENACS_SERVICE_NAME
     [root root]# kill 1496
    -[root root]# ps -auxw | grep service0
    +[root root]# ps -auxw | grep $OPENACS_SERVICE_NAME
     [root root]# su - postgres
    -[postgres pgsql]$ dropdb service0
    +[postgres pgsql]$ dropdb $OPENACS_SERVICE_NAME
     DROP DATABASE
    -[postgres pgsql]$ dropuser service0
    +[postgres pgsql]$ dropuser $OPENACS_SERVICE_NAME
     DROP USER
     [postgres pgsql]$ exit
     logout
     [root 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. Recreate the service user (service0).

    2. Restore the OpenACS files and database backup file.

      [root root]# su - service0
      -[service0 service0]$ cd /var/lib/aolserver
      -[service0 aolserver]$ tar xzf /tmp/service0-backup.tar.gz
      -[service0 aolserver]$ chmod -R 775 service0
      -[service0 aolserver]$ chown -R service0.web service0
    3. Restore the database

      • Oracle.�

        1. Set up a clean Oracle database user and - tablespace with the same names as the ones exported from (more information).

        2. Invoke the import command

          imp service0/service0 FILE=/var/lib/aolserver/service0/database-backup/nighty_backup.dmp FULL=Y
      • Postgres.�If the database user does not already exist, create it.

        [root root]# su - postgres
        -[postgres ~]$ createuser service0
        +            guide.  Recreate the service user ($OPENACS_SERVICE_NAME).

      • Restore the OpenACS files and database backup file.

        [root root]# su - $OPENACS_SERVICE_NAME
        +[$OPENACS_SERVICE_NAME $OPENACS_SERVICE_NAME]$ cd /var/lib/aolserver
        +[$OPENACS_SERVICE_NAME aolserver]$ tar xzf /tmp/$OPENACS_SERVICE_NAME-backup.tar.gz
        +[$OPENACS_SERVICE_NAME aolserver]$ chmod -R 775 $OPENACS_SERVICE_NAME
        +[$OPENACS_SERVICE_NAME aolserver]$ chown -R $OPENACS_SERVICE_NAME.web $OPENACS_SERVICE_NAME
      • Restore the database

        • Oracle.�

          1. Set up a clean Oracle database user and + tablespace with the same names as the ones exported from (more information).

          2. Invoke the import command

            imp $OPENACS_SERVICE_NAME/$OPENACS_SERVICE_NAME FILE=/var/lib/aolserver/$OPENACS_SERVICE_NAME/database-backup/nighty_backup.dmp FULL=Y
        • Postgres.�If the database user does not already exist, create it.

          [root root]# su - postgres
          +[postgres ~]$ createuser $OPENACS_SERVICE_NAME
           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 ~]$ exit
          -

          Because of a bug in Postgres backup-recovery, database objects are not guaranteed to be created in the right order. In practice, running the OpenACS initialization script is always sufficient to create any out-of-order database objects. Next, restore the database from the dump file. The restoration will show some error messages at the beginning for objects that were pre-created from the OpenACS initialization script, which can be ignored.

          [root root]# su - service0
          -[service0 ~]$ createdb service0
          +

          Because of a bug in Postgres backup-recovery, database objects are not guaranteed to be created in the right order. In practice, running the OpenACS initialization script is always sufficient to create any out-of-order database objects. Next, restore the database from the dump file. The restoration will show some error messages at the beginning for objects that were pre-created from the OpenACS initialization script, which can be ignored.

          [root root]# su - $OPENACS_SERVICE_NAME
          +[$OPENACS_SERVICE_NAME ~]$ createdb $OPENACS_SERVICE_NAME
           CREATE DATABASE
          -[service0 ~]$ psql -f /var/lib/aolserver/service0/packages/acs-kernel/sql/postgresql/postgresql.sql service0
          +[$OPENACS_SERVICE_NAME ~]$ psql -f /var/lib/aolserver/$OPENACS_SERVICE_NAME/packages/acs-kernel/sql/postgresql/postgresql.sql $OPENACS_SERVICE_NAME
           (many lines omitted)
          -[service0 ~]$ psql service0 < /var/lib/aolserver/service0/database-backup/database-backup.dmp
          +[$OPENACS_SERVICE_NAME ~]$ psql $OPENACS_SERVICE_NAME < /var/lib/aolserver/$OPENACS_SERVICE_NAME/database-backup/database-backup.dmp
           (many lines omitted)
          -[service0 ~]$ exit
          +[$OPENACS_SERVICE_NAME ~]$ exit
           [postgres ~]$ exit
          -logout
      • Activate the service

        [root root]# ln -s /var/lib/aolserver/service0/etc/daemontools /service/service0
        +logout
    4. Activate the service

      [root root]# ln -s /var/lib/aolserver/$OPENACS_SERVICE_NAME/etc/daemontools /service/$OPENACS_SERVICE_NAME
       [root root]# sleep 10
      -[root root]# svgroup web /service/service0
  • View comments on this page at openacs.org
    +[root root]# svgroup web /service/$OPENACS_SERVICE_NAME
    View comments on this page at openacs.org