Parallels H-Sphere Documentation System Administrator Guide

 

Restoring the H-Sphere System Database From Backup

 
 

Related Docs:   Backing Up H-Sphere Fixing Crashed H-Sphere Database Recovering Control Panel

Last modified: 27 Dec 2007

 

WARNING: This documentation covers Parallels H-Sphere versions up to 3.1. For the latest up-to-date Parallels H-Sphere documentation, please proceed to the official Parallels site.

This documentation explains how to restore the H-Sphere system database from a backup made by the H-Sphere hs_bck script. If you back up your system PostgreSQL database manually using pg_dump, the procedure would be basically the same, except for the backup names and locations.

  1. Restoring the H-Sphere database on a server where PostgreSQL is not installed
  2. Restoring the H-Sphere database content if the database already exists

The backup destination directory for the /hsphere/shared/backup/hs_bck script is set in the /hsphere/shared/backup/hs_bck.cfg config file. The default location is:

BCK_DIR /var/backup

hs_bck stores the system data backup in the following files in the BCK_DIR directory:

  • <ARCHIVE>.tgz - the system data content; <ARCHIVE> is the name of the backup file set in hs_bck.cfg:

    BACKUP hs_bck

    Older backup files are named <ARCHIVE>.1.tgz, <ARCHIVE>.2.tgz, ...
  • hsphere.sql - the H-Sphere system database backup;
  • counter.sql, poll.sql, guestbook.sql - SiteStudio system databases are also backed up if SiteStudio is integrated with H-Sphere.

 

I. Restoring the H-Sphere database on a server where PostgreSQL is not installed:

  1. Log into the server as root:

    su -

  2. Install PostgreSQL to the server.
  3. Start PostgreSQL for the first time:
    On RedHat servers:

    /etc/rc.d/init.d/postgresql start

    On FreeBSD servers, you need to inititiate the PostgreSQL service database manually before you start Postgres:

    su - pgsql -c initdb
    /usr/local/etc/rc.d/010.pgsql.sh start

  4. Log in as PosgreSQL user:
    On RedHat servers (the PostgreSQL service database is initiated automatically on login):

    su - postgres

    On FreeBSD servers:

    su - pgsql

  5. Create the user wwwuser:

    createuser wwwuser

    Answer yes to all prompts.
  6. Enter the PostgreSQL service database:

    psql template1

  7. Restore the wwwuser password:

    alter user wwwuser with password 'old_password';
    alter user pgsql with password 'old_password';

    Here, old_password is the wwwuser password to be restored.
  8. Quit from PostgreSQL:

    \q

  9. Configure PostgreSQL passwords in the ~pgsql/data/pg_hba.conf file, according to instructions provided in this file.
  10. Optimize Postgres for better PostgreSQL performance on powerful servers, esp. when the database is large (more than 1GB).

    Note: It is helpful to set fsync=false in postgresql.conf for the time of recovery. This allows to speed up the process. However, please beware that this may damage the database integrity, and we recommend using this option only on reliable hardware! Don't forget to return to fsync=true after the recovery is complete!

  11. Restart PostgreSQL.
  12. Create H-Sphere database by running:

    createdb -E UNICODE -U wwwuser hsphere

    SiteStudio databases are created in the similar way.
  13. Import the database content from the backup:

    psql -U wwwuser -f <HS_BCK>/hsphere.sql hsphere

    where <HS_BCK> is the backup directory. SiteStudio databases are imported in the similar way.

 

II. Restoring the H-Sphere database content if the database already exists:

  1. Log in to the CP server as root:

    su -

  2. Drop the H-Sphere database:

    dropdb -U wwwuser hsphere

  3. Create the H-Sphere database:

    createdb -E UNICODE -U wwwuser hsphere

  4. Optimize Postgres for better PostgreSQL performance on powerful servers, esp. when the database is large (more than 1GB).

    Note: It is helpful setting fsync=false in postgresql.conf for the time of recovery. This allows to speed up the process. However, please beware that this may damage the database integrity, and we recommend using this option only on reliable hardware! Don't forget to return to fsync=true after the recovery is complete!

  5. Import the database content from the backup:

    psql -U wwwuser -f <HS_BCK>/hsphere.sql hsphere

    where <HS_BCK> is the backup directory.

SiteStudio databases are restored in the same way.


Related Docs:   Backing Up H-Sphere Fixing Crashed H-Sphere Database Recovering Control Panel



© Copyright 2017. Parallels Holdings. All rights reserved.