- Restoring the H-Sphere database on a server
where PostgreSQL is not installed
- Restoring the H-Sphere database content
if the database already exists
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.
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:
- Log into the server as root:
su -
- Install PostgreSQL to the server.
- 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
- Log in as PosgreSQL user:
On RedHat servers (the PostgreSQL service database is initiated automatically on login):
su - postgres
On FreeBSD servers:
su - pgsql
- Create the user wwwuser:
createuser wwwuser
Answer yes to all prompts.
- Enter the PostgreSQL service database:
psql tempate1
- 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.
- Quit from PostgreSQL:
\q
- Configure PostgreSQL passwords in the ~pgsql/data/pg_hba.conf file,
according to instructions provided in this file.
- Here it may be also helpful to
optimize H-Sphere memory usage
for better PostgreSQL performance.
- Restart PostgreSQL.
- Create H-Sphere database:
createdb -U wwwuser hsphere
SiteStudio databases are created in the similar way.
- 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:
- Log in to the CP server as root:
su -
- Drop the H-Sphere database:
dropdb -U wwwuser hsphere
- Create the H-Sphere database:
createdb -U wwwuser hsphere
- 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.
III. Recovering the H-Sphere database from crash:
To be added...
|