|
Starting from HS v.2.4, the system database runs on PostgreSQL 7.3 server.
This version works faster and uses the server memory much more effectively.
Security problems of previous versions have also been fixed there.
Finally, PostgreSQL 7.3 correctly operates with data in UTF encoding, therefore
it enables to store all system data in UTF format, the feature implemented in H-Sphere
2.4 and higher.
Perform the following procedure to upgrade the system PostgreSQL server to version
7.3:
- Stop the Control Panel.
- Dump the H-Sphere system database.
Export schema:
pg_dump -u -s -f db_old.db hsphere
chmod 600 db_old.db
cp db_old.db db.db
Export data:
pg_dump -u -a -f old_data.db hsphere
chmod 600 old_data.db
Note: dump file is created with 644 permissions by default;
you need to set more secure 600 permissions
to prevent the data from being read by other users.
If your system database is large, the dump can take several hours
to complete. You can speed it up by setting
fsync=off
in postgresql.conf. When you are done, unset this option back for safety reasons.
- Dump SiteStudio databases and other databases.
Usually, it requires to dump the following SiteStudio databases: counter, poll, guestbook.
If you have any other databases, you could back them up, too.
You may perform the backup by the pg_dump command.
- It is advisable that you validate or check the databases dump to make sure you'll be able
to recover data after the upgrade. You could make more than one backup.
IMPORTANT: It is highly recommended that you backup your databases into a directory other
than your Postgres home directory so that you would not lose data during Postgres update/install/uninstall
procedure.
- HS 2.4 upgrade only!
Convert the exported data to UTF-8 format (if data has encoding other than ISO-8859-1).
1) For ISO-8859-1, skip this step.
2) For non-Latin 16-bit encodings, do the following:
iconv --from-code=REGIONAL_ENCODING --to-code=UTF-8 -o utf_data.db out.db
mv utf_data.db data.db
The resulting data.db file would contain data correctly converted to UTF-8.
NOTES:
1) If you have data in Latin (8-bit) encoding, you may not have to perform this
data conversion procedure.
2) If you hesitate whether you should apply this procedure to your database, please turn to
HSphere support team for assistance. So far we have tested data conversion from
ISO-8859-1 (Latin), Windows-1251 (Cyrillic), and Windows-874 (Thai) encodings.
- Stop Postgres.
- Upgrade the Postgres RPMs (or packages under FreeBSD).
Or, you can perform the update in two steps:
- uninstall the old Postgres RPMs (packages);
- install the new Postgres RPMs (packages).
- Create the H-Sphere Postgres DB user (usually, wwwuser) and
set the password which is set in the ~cpanel/shiva/psoft_config/hsphere.properties file.
- 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
- Enter as the postgres user:
su - postgres (or, psql for FreeBSD)
- Create wwwuser:
createuser wwwuser
- Configure wwwuser password according to the instructions in Step 4 of
the Postgres Installation document.
- Stop Postgres
- Optimize the H-Sphere database schema (see documentation on
accelerating CP performance).
1) Convert int8 to int4
2) Change the type of l_server_ips.ip_num back to int8
- Start Postgres.
- Recreate the H-Sphere database:
1) create database:
createdb -U wwwuser hsphere
HS 2.4 upgrade only!
If data is in encoding other than ISO-8859-1, specify that you create database in UTF-8:
createdb -E UTF-8 -U wwwuser hsphere
2) create schema:
psql -q -U wwwuser -f db.db hsphere
3) import data:
psql -q -U wwwuser -f data.db hsphere
Note: If you face problems with importing data, please see the
Troubleshooting section in CP Acceleration guide.
- Recreate SiteStudio and other databases from dump files.
- Start the Control Panel.
|